wasm-bingen lib/cli | official
Rust and WebAssembly | official
Rust for Javascripters | Coding Tech Youtube
learn Rust 30 minutes a day - good entry or refresh point
How to Build a REST API in Rust | Medium
web and api auth server in Rust | Medium (1)
debugging Rust-generated WASM | official
- 1.3 Hello, Cargo (official doc)
- An
impl
block is always for a type, so, inside that block
project : ./wasm/wasm-game-of-life/
- 4.4 Game of Live WASM
- 4.5 GoL Testing Life
- 4.8 GoL Time Profiling stopped there. Good place to go for harsh optimisation. Not a priority.
rustup update
: update rust
cargo new --vcs=none [NAME]
: creates a new cargo project and directory, the --vcs=none
flag disable the creation of a git repo.
cargo check
: check that the project compile.
cargo build
: compile. The executable is located at ./target/debug/executable
, it is possibel to run directly from it.
cargo run
: compile and run
cargo build --release
: build for release, removing code for error logging.
wasm-pack build
: compile the rust module to wasm.
wasm-pack test --chrome --headless
: run tests. You can also use the --firefox
, --safari
, and --node
options to test your code in those browsers.
wasm-pack build --debug
: build package for debug.
❮ onyr ★ kenzae❯ ❮ rust❯❯ rustc --version
rustc 1.48.0 (7eac88abb 2020-11-16)
Installing rust
and rustup
, the package and language manager is trivial. Follow instructions here. It's basically a one liner that does all the job.
Use a rust-toolchain
file to specify stable
or nightly
rust toolchain to be used by VSCode and Rust. More info here | StackOverflow.
You can also set VSCode user settings for using stable, read this | GitHub issue.