You will need rustup for managing the Rust toolchain.
Install the stable WebAssembly toolchain via:
rustup toolchain install stable
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
rustup show
You will see something like this:
Default host: x86_64-unknown-linux-gnu
rustup home: $HOME/.rustup
installed targets for active toolchain
--------------------------------------
wasm32-unknown-unknown
wasm32-wasi
x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.67.0 (fc594f156 2023-01-24)
Finally, install wasm-pack (for generating WebAssembly-JS bindings), live-server (a generic live-reloading server), and wasm-tools (toolset for working with WASM, WASI and the component model):
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cargo install live-server
cargo install wasm-tools
All are in didactical order.
- Minimal bindings with only WASM native types
- Calling JS functions fro WebAssemby
- Using
wasm-pack/wasm-bindgenfor generating the JS glue code - Complex types, using shared memory
- Using
web-systo manipulate the DOM