Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Support Matrix

Caution

WASM Threading is not standardized. Rust and wasm-bindgen frequently change the RUSTFLAGS needed to compile with threading support enabled. If you cannot build with the example .cargo/config.toml in this guide, please open an issue on GitHub.

See the source-of-truth for cargo configs Here

Note

This page was last updated on: 2026-08-24

Toolchain minimum versions

  • Rust: Nightly 2026-05-06 (latest tested 1.100.0-nightly)
    • Nightly toolchain is required
  • Wasm-bindgen: >=0.2.127
  • Wasm-pack: master

    Note

    The current latest stable version, 0.15.0, has a version of binaryen over 2 years old. The master branch contains a newer version required to parse some syntax in the DeadCodeElimination pass.

    You can install wasm-pack from GitHub directly with

    cargo install wasm-pack --git https://github.com/wasm-bindgen/wasm-pack --branch master
    

Engine minimum versions

The JS engine must support the Exception Handling with exnref and Threading WASM features. See WebAssembly Feature Status for the most up-to-date version matrix.

The test suite in this project runs all examples on Google Chrome, Microsoft Edge, Firefox, Webkit, NodeJS v24, NodeJS v26, Deno and Bun. You can use the Playground to run the examples with your current browser.

  • Chromium >=151.0
  • Firefox >=153.0
  • Webkit >=revision 2092
  • NodeJS >=24.15 (latest tested 24.19.0, 26.7.0)
    • Earlier versions may work through the --experimental-wasm-exnref flag
  • Deno >=2.3.2 (latest tested 2.9.5)
    • *Note that Deno has an issue where it takes ~5x longer to spin up a worker compared to other engines.
  • Bun >=1.3.14 (latest tested 1.4.0)
    • *Note that Bun has an issue where it sometimes segfaults when trying to grow WASM memory.

Warning

Even though technically the versions can be relaxed if you do not use panic=unwind (meaning you do not need support for Exception Handling with exnref), the test suite only runs for the versions indicated above. Lower engine versions are not guaranteed to work since there can be subtle bugs or behavior differences in the APIs that we depend on.

wasm-pack Target Support

Target\EngineChromium1Firefox1Webkit1NodeJS2Deno3Bun2
no-modules✅✅✅✅✅✅
web✅✅✅✅✅✅
nodejs4,7❌❌❌✅❌✅
deno4,5❌❌❌❌✅✅
bundler4,5,6✅✅✅✅✅✅

Notes:

  • 1: Browsers use the WebWorker API
  • 2: NodeJS and Bun use the node:worker_threads API
  • 3: Deno uses the Worker API because there were issues with node:worker_threads in the test harness setup. However, this might change in the future if the test harness can work around this issue.
  • 4: Targets other than no-modules and web are supported, but you have to also generate the bindgen script for either no-modules or web. See Setup Guide for more details.
  • 5: Additional setup is needed because the bundler and deno targets do not support the wasm_bindgen::module() API. See Setup Guide for more details.
  • 6: None of the engines can natively import the package generated by the bundler target. The test suite uses vite with the vite-plugin-wasm plugin.
  • 7: The nodejs target generates CommonJS and is not recommended if your project is modern and uses ESM. You either need to rename the generated script to use the .cjs extension or remove "type": "module" from package.json, which may have additional consequences.

Rust std API support

If a std API is supported, it means you can use it with the threading model of this library and expect behavior similar to a tier-1 Rust target.

Tip

You can use the Playground to see the examples listed below in action. The playground also links you to the source of the examples.

Note

Legend:

  • ✅ Supported.
  • 🟢 Not supported but a similar API is provided by this crate (for example spawn).
  • ⚠️ Not tested but likely to be supported.
  • ❓ Not tested and unsure if supported.
  • ⛔ Unsupported.
APISupported?Example
std::sync::atomics::*1✅example_arc_atomic
std::sync::mpsc::*✅example_mpsc_channel
std::sync::Arc✅example_arc_atomic
std::sync::Barrier⚠️No tests yet
std::sync::Condvar⚠️No tests yet
std::sync::LazyLock⚠️No tests yet
std::sync::Mutex2✅example_mutex example_mutex_poison
std::sync::Once⚠️No tests yet
std::sync::OnceLock⚠️No tests yet
std::sync::RwLock⚠️No tests yet
std::sync::Weak⚠️No tests yet
std::thread::Builder⛔ 3
std::thread::JoinHandle🟢
std::thread::LocalKey and thread_local!✅No tests yet
std::thread::Thread::id() and ThreadId✅Used by harness
std::thread::Thread::name()❓No tests yet
std::thread::Thread::unpack()❓No tests yet
std::thread::available_parallelism⛔ 4example_available_parallelism
std::thread::current✅Used by harness
std::thread::panicking❓No tests yet
std::thread::park❓No tests yet
std::thread::scope⛔ 3
std::thread::sleep✅example_mutex example_mpsc_channel
std::thread::spawn🟢
std::thread::yield_now⛔ 5

Notes:

  • 1: Atomics are part of the WASM threading proposal.
  • 2: Poisoning works when panic=unwind.
  • 3: A similar API might be added to this crate in the future.
  • 4: Use navigator.hardwareConcurrency.
  • 5: Does nothing. To run the thread co-operatively with the JS event loop, use spawn_async.