Rust & Webassembly
I barely know Rust but I like when things are easily accessible so I will try to figure out how to compile to webassembly and how to use the result. I will try to take some notes about the process here.
The following is in my opinion the best way to get started with Rust & Webassembly 🦀🕸. It avoids npm, cargo-generate, webpack and other things the tutorial throws at you.
- Install wasm-pack using cargo install wasm-pack
- Grab the no-bullshit example from wasm-bindgen
- Run wasm-pack build --target web to compile your Rust to Webassembly
- Open index.html in your browser or - for example - serve with python3 -m http.server. Unfortunately, I cannot upload an example here since it would require a supporter account.
Possibly useful links:
- https://rustwasm.github.io/docs/book/
- https://rustwasm.github.io/docs/wasm-bindgen/introduction.html#introduction
- https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/getting-started/manual-setup.html (I'm losing track of all the documentation for this stuff...)
- https://jakedeichert.com/blog/2018/01/my-experience-with-webassembly-and-rust-so-far/
- http://chinedufn.com/3d-webgl-basic-water-tutorial/