Skip to main content

generate_erased_wrapper

Function generate_erased_wrapper 

Source
fn generate_erased_wrapper(input: &DeriveInput) -> TokenStream
Expand description

Generate the type-erased wrapper infrastructure for trait ABI dispatch.

For #[derive(ExternalPtr)] struct MyCounter { ... } generates:

  • __MX_TAG_MyCounter - concrete type tag (FNV-1a hash of module_path + type)
  • __MX_BASE_VTABLE_MyCounter - base vtable with trait/sidecar query
  • __mx_wrap_MyCounter - constructor returning *mut mx_erased