Crate web_worker

Source
Expand description

Utilities to work with web workers and rayon.

Macros§

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

Structs§

WorkerPool
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§

child_entry_point
Entry point invoked by worker.js, a bit of a hack but see the “TODO” above about worker.js in general.
default_thread_pool
Creates a new rayon::ThreadPool with default concurrency value provided by the browser
init_panic_hook
Initializes the logging of panics originating from the rust code. Must be called once at the start of the execution.
log
External binding to the js console.log method. You probably want to use console_log!() instead of this.
new_thread_pool
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.