A couple weeks ago, I saw Rachel's Rust generative art app and since then, I've been gunning to make a Rust web app of my own. Like most Rust documentation, the go to web app tutorial is informative and easy to follow. However, it assumes use of npm and a Javascript bundler whereas I wanted to avoid installing extra stuff. If for whatever reason that resonates with someone, maybe this post will be helpful.
If not, skip to the bottom to see the thing!
The point of all this is to write performant stuff in Rust, compile it into webassembly (Wasm) using wasm-pack
, and have your regular, bloated Javascript call on the Wasm to do heavy lifting. In order to expose Rust/Wasm functions so that they can be called from Javascript, we use the Rust crate [wasm-bindgen
](https://crates.io/crates/wasm-bindg