A Rust program can be compiled to WebAssembly as a library or a full runnable entry point (if the project type is binary).
To compile to WebAssembly, we need to have a wasm32 compile target:
$ rustup target add wasm32-unknown-unknown
For convenience, using cargo-web seems like a widely accepted method:
$ cargo install cargo-web
And then, the actual compile and run:
$ cargo web start --target=wasm32-unknown-unknown
For exposing your data structures to WebAssembly, take a look at [wasm-bindgen].
Welcome! Look like you've found my personal notebook. This is the place where you can take a peek into my mind to see what I've been…
If you think this note resonated, be it positive or negative, please feel free to send me an email and we can talk.