Rust & WASM in Detail¶
A Basic wasm-pack¶
Start a new lib
cargo build --lib
Write Code
wasm-pack build
Notes about Crates¶
reqwest doesn’t work
Debuging¶
https://rustwasm.github.io/docs/book/reference/debugging.html
The .js file is generated by wasm-bindgen and contains JavaScript glue for importing DOM and JavaScript functions into Rust and exposing a nice API to the WebAssembly functions to JavaScript. For example, there is a JavaScript greet function that wraps the greet function exported from the WebAssembly module. Right now, this glue isn’t doing much, but when we start passing more interesting values back and forth between wasm and JavaScript, it will help shepherd those values across the boundary.
Crates¶
https://rustwasm.github.io/docs/book/reference/crates.html https://lib.rs/wasm
- https://lib.rs/crates/serde-wasm-bindgen
Serde Crate that is optimised to use JavaScript APIs (Up to 3.6x faster)
- https://lib.rs/crates/wasm-rpc
Solution, but in nightly
- https://lib.rs/crates/neso
A NES emulator