Crate web_worker

Source
Expand description

Utilities to work with web workers and rayon.

Macros§

  • Macro allowing to write to the js/browser’s console. You must import web_worker::log into scope to use this macro.

Structs§

  • The WorkerPool. This is a special type of thread pool that works on wasm and provide a way to run work they way rayon does it.

Functions§

  • Entry point invoked by worker.js, a bit of a hack but see the “TODO” above about worker.js in general.
  • Creates a new rayon::ThreadPool with default concurrency value provided by the browser
  • Initializes the logging of panics originating from the rust code. Must be called once at the start of the execution.
  • External binding to the js console.log method. You probably want to use console_log!() instead of this.
  • Creates a new rayon::ThreadPool from the provided WorkerPool (created in the javascript code) and the concurrency value, which indicates the number of threads to use.