Expand description
Shared trait bridge code generation.
Generates wrapper structs that allow foreign language objects (Python, JS, etc.)
to implement Rust traits via FFI. Each backend implements TraitBridgeGenerator
to provide language-specific dispatch logic; the shared functions in this module
handle the structural boilerplate.
Structs§
- Trait
Bridge Spec - Everything needed to generate a trait bridge for one trait.
Traits§
- Trait
Bridge Generator - Backend-specific trait bridge generation.
Functions§
- gen_
bridge_ all - Generate the complete trait bridge code block: imports, struct, impls, and optionally a registration function.
- gen_
bridge_ plugin_ impl - Generate
impl Plugin for Wrapperwhen the trait hasPluginas a super-trait. - gen_
bridge_ registration_ fn - Generate the
register_xxx()function that wraps a foreign object and inserts it into the plugin registry. - gen_
bridge_ trait_ impl - Generate
impl Trait for Wrapperdispatching each method through the generator. - gen_
bridge_ wrapper_ struct - Generate the wrapper struct holding the foreign object and cached fields.