Installing wasm-bindgen
wasm-bindgen
is used to bind entities from Rust into JavaScript and vice versa.
wasm-bindgen
makes it more natural to import exported entities from Rust into JavaScript. JavaScript developers will find that wasm-bindgen
's use of WebAssembly is similar to JavaScript.
This enables the use of richer and easier APIs while converting Rust into a WebAssembly module. wasm-bindgen
uses these features and provides a simple API to use. It ensures that there is high-level interaction happening between wasm modules and JavaScript.
wasm-bindgen
provides a channel between JavaScript and WebAssembly to communicate something other than numbers, such as objects, strings, and arrays.
To install wasm-bindgen-cli
, use the following cargo
command:
$ cargo install wasm-bindgen-cli
Once successfully installed, let's run the wasm-bindgen
CLI:
$ wasm-bindgen --help Generating JS bindings for a wasm file Usage: wasm-bindgen...