Crate wasm_bindgen_externref_xform[][src]

Expand description

Transformation for wasm-bindgen to enable usage of externref in a wasm module.

This crate is in charge of enabling code using wasm-bindgen to use the externref type inside of the wasm module. This transformation pass primarily wraps exports and imports in shims which use externref, but quickly turn them into i32 value types. This is all largely a stopgap until Rust has first-class support for the externref type, but that’s thought to be in the far future and will take quite some time to implement. In the meantime, we have this!

The pass here works by collecting information during binding generation about imports and exports. Afterwards this pass runs in one go against a wasm module, updating exports, imports, calls to these functions, etc. The goal at least is to have valid wasm modules coming in that don’t use externref and valid wasm modules going out which use externref at the fringes.


State of the externref pass, used to collect information while bindings are generated and used eventually to actually execute the entire pass.