wasm-bindgen-spawn
wasm-bindgen-spawn is a Web Worker based multithreading library for Rust and WebAssembly.
This uses the WebAssembly threads proposal
and shared memory to communicate between workers (once they are started), instead of postMessage.
The threads proposal is currently in phase 4 and available in all major browsers and runtimes.
Note
This library will remain on version
0.0.xuntil all features required are in stable Rust, standardized in WASM, and baseline widely available across browsers.
Caution
Rust and
wasm-bindgenfrequently change theRUSTFLAGSneeded to compile with threading support enabled. If you cannot build with configs given in this guide, please open an issue on GitHub.
Caution
Ensure you are using a supported version of the tools and engines. We are working at the very cutting edge. Most tools require the latest version or even building from source for unreleased bug fixes.
Getting Started
- See Support Matrix for the toolchains, JS engine, and
wasm-packtarget support. - See Setup Guide for how to setup your project to use this library.
- See Playground for runnable examples that also link to the example source code on GitHub.
- The remaining chapters of the book cover basic usage of the library. for advanced technical reference, see the API documention on docs.rs
Special thanks
wasm-mtproject for the links they put in the README which sparked my interest to do a deep dive and ultimately create this project.wasm-bindgen-rayonproject, which helped me understanding the prerequisites like Cross-Origin Isolation- Ciantic’s experimental work - very helpful in getting a basic example up and running