google/crubit
A bidirectional bindings generator for C++ and Rust.
https://skillcdn.ai/gh/google/crubitConnect this address to your AI to use these skills. How to connect
- Unverified
- Default branch
main - Commit
a9601ab - License
Apache-2.0
Explore this repository
Searches the original text of skills and documents; display translations are not searched.
Documents
- BuildingTo use Rust libraries from C++, you need to integrate Crubit into your build system.docs/rust/building.md
- Generating C++ `enum`s from Rust `enum`sBy default, a Rust enum is mapped to an opaque C++ type (see C++ bindings for Rust enums). However, Crubit can try to map Rust enums to C++ enums if requested using the #[cpp_enum] attribute. C++ cod…docs/rust/cpp_enums.md
- Attributes to fine-tune generated bindingsCrubit offers attributes to allow users to customize the functionality of the generated bindings, such as renaming a type or function or converting Rust values into a particular C++ type.docs/rust/customizing.md
- C++ bindings for Rust `enum`sA Rust enum is mapped to an opaque C++ type.docs/rust/enums.md
- C++ bindings for Rust functionsC++ code can call functions defined in Rust, provided that the parameter and return types are supported by Crubit:docs/rust/functions.md
- C++ bindings for Rust librariesRust libraries can be used directly from C++. This page documents roughly what that entails, and additional subpages (available in the left-hand navigation) document specific aspects of the generated…docs/rust/index.md
- Rust's MaybeUninit typeRust provides a type called MaybeUninit<T>, which represents a T which may be incompletely initialized, or even totally uninitialized. While a variable of type T, &T or &mut T must refer to a fully i…docs/rust/maybe_uninit.md
- Movable typesCrubit requires types to be "movable" to be passed by value: if a Rust type does not logically support a C++ move operation, then it can receive bindings, but it cannot be passed by value.docs/rust/movable_types.md
- C++ bindings for Rust standard library (`std`) typesWhen generating C++ bindings for a Rust crate (via cpp_api_from_rust) bindings to the Rust standard library types (std, alloc, and core) are automatically generated for those types under the namespac…docs/rust/std.md
- C++ bindings for Rust structsA Rust struct is mapped to a C++ class/struct with the same fields. If any field cannot be represented in C++, the struct itself will still have bindings, but the relevant field will be private.docs/rust/structs.md
- C++ bindings for Rust traitsCrubit allows C++ callers to invoke Rust trait implementations. For each trait SomeTrait, Crubit generates a matching C++ struct MyTrait. To call a trait method SomeTrait::some_fn implemented by Some…docs/rust/traits.md
- C++ bindings for Rust type aliases.A rust Rust type aliases, such as pub type X = ...;, is mapped to the equivalent C++ type alias, such as using X = ...;.docs/rust/type_aliases.md
- C++ bindings for Rust `use` declarationsCrubit supports use declarations for functions and types, mapping them to equivalent using declarations in C++.docs/rust/use_declarations.md