Lines Matching full:rust
1 {{#title extern "Rust" — Rust ♡ C++}}
2 # extern "Rust"
4 ```rust,noplayground
7 extern "Rust" {
13 The `extern "Rust"` section of a CXX bridge declares Rust types and signatures
16 The CXX code generator uses your extern "Rust" section(s) to produce a C++
18 has the same path as the Rust source file containing the bridge, except with a
21 A bridge module may contain zero or more extern "Rust" blocks.
23 ## Opaque Rust types
25 Types defined in Rust that are made available to C++, but only behind an
28 ```rust,noplayground
31 extern "Rust" {
40 way. Rust code created the `MultiBuf`, passed a `&mut MultiBuf` to C++, and C++
41 later passed a `&mut MultiBuf` back across the bridge to Rust.
44 exposes the Rust standard library's `std::fs::File` to C++ as an opaque type in
54 opaque Rust type. These restrictions may be lifted in the future.
56 [`Sized`]: https://doc.rust-lang.org/std/marker/trait.Sized.html
57 [`Unpin`]: https://doc.rust-lang.org/std/marker/trait.Unpin.html
59 For now, types used as extern Rust types are required to be defined by the same
66 ```rust,noplayground
75 # extern "Rust" {
84 Rust functions made callable to C++.
90 ```rust,noplayground
93 extern "Rust" {
106 Extern Rust function signature may consist of types defined in the bridge,
111 Any signature with a `self` parameter is interpreted as a Rust method and
114 ```rust,noplayground
117 extern "Rust" {
128 If the surrounding `extern "Rust"` block contains exactly one extern type, that
134 ```rust,noplayground
137 extern "Rust" {
148 An extern Rust function signature is allowed to contain explicit lifetimes but
154 ```rust,noplayground
157 extern "Rust" {