build_wasm!() { /* proc-macro */ }Expand description
Invokes cargo build at compile time on another module, replacing this macro invocation
with the bytes contained in the output .wasm file.
§Usage
ⓘ
let module = build_wasm!("relative/path/to/module");§Arguments
This macro can take a number of additional arguments to control how the WebAssembly should be generated.
These options are passed to cargo build:
ⓘ
let module = build_wasm!{
path: "relative/path/to/module",
features: [
atomics, // Controls if the `atomics` proposal is enabled
bulk_memory, // Controls if the `bulk-memory` proposal is enabled
mutable_globals, // Controls if the `mutable-globals` proposal is enabled
],
// Allows additional environment variables to be set while compiling the module.
env: Env {
FOO: "bar",
BAX: 7,
},
// Controls if the module should be built in debug or release mode.
release: true
};