Crate gloo::worker

source ·
Available on crate feature worker only.
Expand description

Workers are a way to offload tasks to web workers. These are run concurrently using web-workers.

Communicating with workers

Bridges

After a Worker is spawned, a bridge is created. A Bridge allows bi-directional communication between an worker and a component. Bridges also allow workers to communicate with one another.

Scopes

Scopes are used by workers to communicates with bridges and send updates to itself after a task is finished.

Overhead

Gloo Workers use web workers. They incur a serialization overhead on the messages they send and receive. Bridges use bincode by default to communicate with workers, so the cost is substantially higher than just calling a function.

Structs

Traits

  • Message Encoding and Decoding Format
  • A trait to enable public workers being registered in a web worker.
  • A Worker that can be spawned by a spawner.
  • Declares the behaviour of a worker.