Skip to main content

format_wasm_registry

Function format_wasm_registry 

Source
pub fn format_wasm_registry(
    call_defs: &[CallDefRow],
    altrep_regs: &[AltrepRegRow],
    trait_dispatches: &[TraitDispatchRow],
) -> String
Expand description

Format a wasm_registry.rs source file from extracted runtime data.

Output structure:

// header (auto-generated marker, generator-version, content-hash)
use ...;
unsafe extern "C-unwind" { fn <wrapper>(...); ... }
unsafe extern "C" { fn <altrep_reg>(); ... static <vtable>: u8; ... }
pub static MX_CALL_DEFS_WASM: &[R_CallMethodDef] = &[ ... ];
pub static MX_ALTREP_REGISTRATIONS_WASM: &[AltrepRegistration] = &[ ... ];
pub static MX_TRAIT_DISPATCH_WASM: &[TraitDispatchEntry] = &[ ... ];

Every fn / static referenced from a slice gets a matching extern decl — the WASM linker resolves them against the user crate’s #[no_mangle] exports.