1{{#title The bridge module — Rust ♡ C++}} 2# The bridge module reference 3 4The ***[Core concepts](concepts.md)*** in chapter 2 covered the high level model 5that CXX uses to represent a language boundary. This chapter builds on that one 6to document an exhaustive reference on the syntax and functionality of 7\#\[cxx::bridge\]. 8 9- ***[extern "Rust"](extern-rust.md)*** — exposing opaque Rust types, Rust 10 functions, Rust methods to C++; functions with lifetimes. 11 12- ***[extern "C++"](extern-c++.md)*** — binding opaque C++ types, C++ 13 functions, C++ member functions; sharing an opaque type definition across 14 multiple bridge modules or different crates; using bindgen-generated data 15 structures across a CXX bridge; Rust orphan-rule-compatible way to request 16 that particular glue code be emitted in a specific bridge module. 17 18- ***[Shared types](shared.md)*** — shared structs; shared enums; using 19 Rust as source of truth vs C++ as source of truth. 20 21- ***[Attributes](attributes.md)*** — working with namespaces; giving 22 functions a different name in their non-native language. 23 24- ***[Async functions](async.md)*** — integrating async C++ with async 25 Rust. 26 27- ***[Error handling](binding/result.md)*** — representing fallibility on 28 the language boundary; accessing a Rust error message from C++; customizing 29 the set of caught exceptions and their conversion to a Rust error message. 30