gloo_worker

Module oneshot

Source
Expand description

A future-based worker that for each input, one output is produced.

§Example

use gloo_worker::oneshot::oneshot;
use gloo_worker::Spawnable;

#[oneshot]
async fn Squared(input: u32) -> u32 {
    input.pow(2)
}

// consuming the worker
let mut squared_bridge = Squared::spawner().spawn("...");
assert_eq!(squared_bridge.run(2).await, 4);

Structs§

OneshotBridge
A connection manager for components interaction with oneshot workers.
OneshotRegistrar
A registrar for oneshot workers.
OneshotSpawner
A spawner to create oneshot workers.

Traits§

Oneshot
A future-based worker that for each input, one output is produced.

Attribute Macros§

oneshot
Creates an oneshot worker.