The CXX crate makes it possible to do safe interoperability between Rust and C++.
The overall approach looks like this: