Skip to content

Commit

Permalink
Update guidance about use of the Result type
Browse files Browse the repository at this point in the history
  • Loading branch information
the80srobot committed Dec 14, 2023
1 parent 74da3ea commit 6e8136b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/development/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ Additionally, please follow these guidelines:
* Keep the Rust code to the leaves.
* Don't hand over control between Rust and C++ more than absolutely necessary.
* Have C++ call into Rust, not the other way around.
* Don't use cxx to return `Result` types across the FFI. (It might throw a C++
exception.)
* Use of `Result` types across the FFI is permitted, because it is the only enum
(variant) type Cxx supports and the only good way to indicate failures. If you
do return `Result`, **you MUST wrap the C++ call site in a `try-catch`
block.**
* Run `cargo fix && cargo fmt` before submitting code for review. You may need to run the
nightly to support all options in `rustfmt.toml`: `rustup run nightly cargo
fmt`.
Expand Down

0 comments on commit 6e8136b

Please sign in to comment.