Skip to content

Repository files navigation

wasm-bindgen-spawn

Version Badge License Badge Issue Badge

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.

At the current stage, this is the closest thing to std::thread::spawn that "Just Works" for wasm32-unknown-unknown target. For example you can:

  • Spawn a thread with a Rust closure
  • Join a thread
  • Send data between threads using channels
  • Synchronize threads using std::sync primitives

Nightly Rust toolchain is required for unstable features. This library will remain on version 0.0.x until all features required are in stable Rust, standardized in WASM, and baseline widely available across browsers.

Examples

The Playground has runnable examples and links to their source code on GitHub.

Documentation

Contributing

Contribution is accepted. Please refer to the Contribution Guidelines

About

A Web Worker based multithreading library for Rust and Assembly

Topics

Resources

Stars

20 stars

Watchers

0 watching

Forks

Contributors

Languages