Expand description
Vtable static generation, C wrapper generation, and method attribute parsing for trait impls.
This module contains the core codegen for #[miniextendr] on impl Trait for Type blocks.
It produces the vtable static constant, C-callable wrapper functions for each method and
associated constant, and delegates to super::r_wrappers for R wrapper code generation.
Structs§
- Trait
Method 🔒Attrs - Parsed
#[miniextendr(...)]attributes for a single trait method.
Functions§
- check_
trait_ 🔒method_ defaults - Reject a
defaults(...)entry that names no parameter of the trait method, with the inherent-impl wording (a typo would otherwise drop the default without a word). - declared_
param_ 🔒names - The parameter names the declaration’s metadata gives
method, in order. The metadata names every parameter (arg<i>for a declaration pattern). - extract_
consts 🔒 - Extract associated constant items from a trait impl block.
- extract_
methods 🔒 - Extract all methods from a trait impl block as
TraitMethodstructs. - generate_
concrete_ 🔒vtable_ shims - Generate concrete vtable shims for a generic trait impl.
- generate_
impl_ 🔒vtable - Reproduce the declaration’s repr(C) layout locally, with its exact field order and callback types. The versioned declaration tag guards the cast to the consumer’s nominal vtable type. The exported static’s name and byte representation stay the same for native and wasm registration.
- generate_
trait_ 🔒const_ c_ wrapper - Generate a C wrapper function and
R_CallMethodDeffor a trait associated constant. - generate_
trait_ 🔒method_ c_ wrapper - Generate a C wrapper function and
R_CallMethodDeffor a single trait method. - generate_
vtable_ 🔒static - Generate the vtable static, C wrappers, R wrappers, and call defs for a trait implementation.
- inherit_
method_ 🔒metadata - Inherit only declaration-level R naming/export metadata. The implementation owns its execution options, docs and signatures; an explicit impl rename wins, while a declaration’s skipped method is never exported accidentally.
- parse_
trait_ 🔒method_ attrs - Parse
#[miniextendr(...)]attributes from a trait method.