Lines Matching +full:rust +full:- +full:lang
1 {{#title Other Rust–C++ interop tools — Rust ♡ C++}}
2 # Context: other Rust–C++ interop tools
4 When it comes to interacting with an idiomatic Rust API or idiomatic C++ API
8 - Build a C-compatible wrapper around the code (expressed using `extern "C"`
9 signatures, primitives, C-compatible structs, raw pointers). Translate that
14 - Build a C wrapper around the C++ code and use **[bindgen]** to translate that
15 programmatically to `extern "C"` Rust signatures. Preferably, build a
16 safe/idiomatic Rust wrapper on top.
18 - Build a C-compatible Rust wrapper around the Rust code and use **[cbindgen]**
26 [bindgen]: https://github.com/rust-lang/rust-bindgen
33 related to C++ is best-effort only. Bindgen starts from a point of wanting to
38 memory-unsafe things at runtime whenever called.
40 [bindgen#388]: https://github.com/rust-lang/rust-bindgen/issues/388
41 [bindgen#380]: https://github.com/rust-lang/rust-bindgen/issues/380
42 [bindgen#607]: https://github.com/rust-lang/rust-bindgen/issues/607
43 [bindgen#652]: https://github.com/rust-lang/rust-bindgen/issues/652
44 [bindgen#778]: https://github.com/rust-lang/rust-bindgen/issues/778
45 [bindgen#1194]: https://github.com/rust-lang/rust-bindgen/issues/1194
53 containing a pointer ([bindgen#778]) and is not directly expressible in Rust.
56 anything involving a non-trivial copy constructor, destructor, or inheritance,
64 Imagine Rust and C and C++ as three vertices of a scalene triangle, with length
68 The most similar pair (the shortest edge) is Rust–C++. These languages
76 C++ down to C, and C back up to Rust. The Rust–C edge always involves a
79 a string to the other language?" becomes a strap-yourself-in moment,
82 You should think of the `cxx` crate as being the midpoint of the Rust–C++
84 in Rust and half the short edge in C++, in both cases with the library playing
85 to the strengths of the Rust type system *and* the C++ type system to help
90 C++ and the Rust side *really* looks like we are just writing Rust. Anything you
91 could do wrong in Rust, and almost anything you could reasonably do wrong in
97 runtime-checked in between.
108 header and/or Rust module (and/or IDL like Thrift) and emit the corresponding