# wasm + rust # wasm by example walkthrough source: https://wasmbyexample.dev/examples/hello-world/hello-world.rust.en-us.html - `wasm-pack` - `cargo install wasm-pack` - https://crates.io/crates/wasm-pack - build tool for rust-generated wasm for interop with js - `wasm-bindgen` - `cargo add [email protected]` - https://crates.io/crates/wasm-bindgen - high-level interactions between wasm modules and js - https://rustwasm.github.io/docs/wasm-bindgen/ > More specifically this project allows JS/wasm to communicate with strings, JS objects, classes, etc, as opposed to purely integers and floats. Using wasm-bindgen for example you can define a JS class in Rust or take a string from JS or return one. The functionality is growing as well! - building - `wasm-pack build --target web` (target web to output ES6 module) - outputs `pkg/` directory - shared memory between `pub static mut WASM_MEMORY_BUFFER: [u8; buffer_size]` and `new Uint8Array(rustWasm.memory.buffer)` - https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Table - https://observablehq.com/@kylebarron/zero-copy-apache-arrow-with-webassembly