pub(super) fn generate_vtable_static(
impl_item: &ItemImpl,
trait_path: &Path,
concrete_type: &Type,
impl_attrs: &ImplAttrs,
abi: &TraitAbiMetadata,
declaration: &[TraitItemFn],
defaults: &[ImplItemFn],
) -> TokenStreamExpand description
Generate the vtable static, C wrappers, R wrappers, and call defs for a trait implementation.
This is the main entry point for trait impl codegen. For a given
impl Trait for Type { ... } block, it produces:
- The cleaned original impl block (with
#[miniextendr]attrs stripped from methods) - A
static __VTABLE_{crate}_{Trait}_FOR_{Type}with the declared repr(C) layout - C wrapper functions and
R_CallMethodDefentries for each method and const - R wrapper code string (class-system specific)
- Two
constitems:{TYPE}_{TRAIT}_CALL_DEFSandR_WRAPPERS_{TYPE}_{TRAIT}_IMPL
§Arguments
impl_item: The parsedimpl Trait for Typeblocktrait_path: Full path to the trait (e.g.,crate::Counter)concrete_type: The implementing type (e.g.,MyCounter)impl_attrs: The impl block’s options. The class system picks the R wrapper generator;blanketskips emitting the impl block (a blanket impl already provides it);internal/noexportcontrol the roxygen export tags;no_preconditionsdrops the R-side type checks, as on an inherent impl.abi: The canonical trait name, fingerprint and callback layout from the declaration.