Skip to main content

Module prebindgen

Module prebindgen 

Source
Expand description

Prebindgen — what a generator still hands the emitter.

One method per #[prebindgen] item kind (on_function, on_struct, on_enum, on_const) returning the wrapper Rust tokens to emit, plus the items they depend on (prerequisites), a cross-cutting rewrite (post_process_item) and two invariant checks.

Conversion is not here. A generator builds those itself, against the demand RegistryBuilder::crossings hands it, and gives them back through RegistryBuilder::convert_with — so there is no on_input_type, no deferral, and no fixed-point loop retrying until it converges.

ConverterImpl::function is the complete Rust function for a converter — signature, body, attributes, lifetimes. The generator owns 100% of the shape. Callers read the name from function.sig.ident and the wire form from destination.

Structs§

ConverterImpl
Result of resolving one converter — the wire (destination) type the rest of the registry sees, plus the complete generated function.
Stage
One link in a converter’s stage chain — a value-inspecting step that sits between the rust value the #[prebindgen] fn yields/receives and the wire-facing ConverterImpl::function.

Traits§

Prebindgen
The single extension point of the pipeline: implement this trait once per destination language (C/cbindgen, JNI/Kotlin, Swift, Python, …) to teach the language-agnostic Registry how that language represents Rust types on the wire and what wrapper code to emit.

Type Aliases§

NamePredicate
A shared predicate over an item name, as used by Prebindgen’s ignore hooks (bulk ignores keyed on a naming family rather than an exact ident).