25 releases

0.2.62 May 1, 2020
0.2.60 Mar 26, 2020
0.2.56 Dec 20, 2019
0.2.55 Nov 19, 2019
0.2.40 Mar 22, 2019

#1673 in WebAssembly

Download history 16/week @ 2024-09-23 6/week @ 2024-09-30 1/week @ 2024-10-07 1/week @ 2024-11-18 171/week @ 2024-12-09

172 downloads per month

MIT/Apache

30KB
530 lines

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

This crate is in charge of enabling code using wasm-bindgen to use the anyref type inside of the wasm module. This transformation pass primarily wraps exports and imports in shims which use anyref, but quickly turn them into i32 value types. This is all largely a stopgap until Rust has first-class support for the anyref 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 anyref and valid wasm modules going out which use anyref at the fringes.

Dependencies

~4MB
~83K SLoC