Include Wasm-RS
Builds a Rust WebAssembly module at compile time and returns the bytes.
Example
let module = build_wasm!;
This crate provides a wrapper around cargo to build and then include a WebAssembly module at compile time. This is intended for use in unit tests, where the target platform may not be able to invoke cargo itself, for example while using MIRI or when executing the compiled module on the Web.
Toolchain
To use this crate, you must have the wasm32-unknown-unknown nightly toolchain installed, and have the rust-src component. You can install these with the following commands:
Arguments
The build macro allows for an assortment of arguments to be passed to the build command:
let module = build_wasm!;
Features
If you're on nightly, the proc_macro_span feature will enable better call site location resolution.