A practical guide to introducing Rust into an existing C++ codebase using the `cxx` crate. Covers setting up the `#[cxx::bridge]` macro, declaring opaque types, exposing Rust methods to C++, handling limitations like consuming methods and unsupported types, and generating C++ bindings via `cxx-build`. Includes a working CRC32 hashing example with a C++ main function calling Rust code, plus a deep dive into the macro expansion to understand how `cxx` enforces safety at the FFI boundary.

16m read timeFrom tweedegolf.nl
Post cover image
Table of contents
The toolingCooking some hashWater under the bridgeimpl HasherThe other sideBy the wayStitching upRecapIntroducing Rust in your commercial project?
2 Impressions