Closed aohanhe closed 3 months ago
Working with std::string
in Rust is apparently quite awkward as it has a move constructor. The cxx
crate is designed to provide access to C++ standard library types in Rust and vice versa for FFI - see https://cxx.rs/binding/cxxstring.html.
Yeah, it's really not properly supported by bindgen since it has interior pointers, and the implementation is not public anyways, so anything you do kinda would need to call into custom C++ code, which is out of scope for bindgen. autocxx also does something like that on top of bindgen iirc?
c++ code
build.rs
bindings.rs
The problem I ran into was how do I instantiate this root::std:string? thanks