/cpp/customizing
The Rust bindings for a C++ declaration can be customized using an attribute macro from <crubit/support/annotations.h>
.
For instance:
unsafe
in Rust, even if Crubit would otherwise assume it was safe, using CRUBIT_UNSAFE
.CRUBIT_MUST_BIND
.CRUBIT_RUST_NAME("rust_name_here")
.More information:
//support/public:annotations
#include <crubit/support/annotations.h>
Given the following C++ header:
cs/file:examples/cpp/unsafe_attributes/example.h symbol:SafeSignatureButAnnotatedUnsafe
Crubit will generate the following bindings:
cs/file:examples/cpp/unsafe_attributes/example_generated.rs symbol:SafeSignatureButAnnotatedUnsafe