Skip to main content

Module vtable

Module vtable 

Source
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§

TraitMethodAttrs 🔒
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 TraitMethod structs.
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_CallMethodDef for a trait associated constant.
generate_trait_method_c_wrapper 🔒
Generate a C wrapper function and R_CallMethodDef for 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.