- MDN's Rust-WASM intro.
- A slightly more involved example with the Rust-wasm book 📖
- Move to Trunk
- Remaining exercises time-optimization and size-optimization
- Check out
js_ffi
orjs-wasm
as the former seems deprecated - Check out the
js!
macro - Wrap it into a Web Component
- wasm-bindgen
- wasm-pack
- In general the rust-wasm docs and blog!
- Run JS in WASI post on wasm.builders
- Try out WALT
- https://nercury.github.io/rust/opengl/tutorial/2018/02/08/opengl-in-rust-from-scratch-00-setup.html
- https://crates.io/crates/wgpu
- https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-tutorial.md#from-rust
- https://deno.com/blog/roll-your-own-javascript-runtime
Follow MDN tutorial, Rust-WASM.
- Created a library crate
- Use
wasm_bindgen
to generate bindings:- Call JS's
alert
from Rust - Call a Rust function
greet
from JS
- Call JS's
- Compiled to WASM
- Tests on local server
- Create a NPM symlink package
- Import NPM symlink into a sample project
- Run the sample project
This was similar to https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html although that seems to be a bit out of date, check the comment on webpack imports
Next:
- Configure TypeScript in the sample project, and check imports and definitions.
Done today:
- Updated to webpack 5
- Transpiled using SWC 🦀
- Added TypeScript
- Used top level await and wasm async experimental features
- A very rude performance test
Next:
- Try something more ambitious, follow up tutorial from rust-wasm book
Done today:
- Adapted example from rust-wasm book to use TypeScript and SWC on Webpack.
- Followed until https://rustwasm.github.io/docs/book/game-of-life/implementing.html#rendering-to-canvas-directly-from-memory
Next:
- Continue book example
- Published to NPM https://www.npmjs.com/package/glife-wasm
- Deployed to Vercel https://samuelsh-glife-wasm.vercel.app/
- Improved NPM scripts for development and build
- Bug hunting re.
wasm-pack build
rustwasm/wasm-pack#990 - Exercises section 4.4 rust-wasm book
- Added interactivity
- Styled with PicoCSS
Next:
- Try to write directly into memory.
- Cells are modified directly in memory on mouse over.
- Removed pause interaction
- Headless tests w/
wasm_bindgen_test
Next:
- Continue rust-wasm book
- Bump rand dep, fixed feature errors
- Fixed
extern crate
error ontests/
- Profiling and optimizations
- Improved canvas drawing performance drastically, using bitmap image
- Fixed user interactions
- New timer class
- Tiding up README and docs
- Encapsulated in a Web Component
- Responsive to width and height attributes
- Styles, favicon, and font
- Cleanup dependencies and webpack settings
- Removed wasm-pack and replaced with manual build steps using wasm-bindgen
- Separate
site
from Rust module - Added custom elements manifest and VScode custom data format
- House keepin: updates, package.json, READMEs, etc.