Module gloo_worker::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

Traits

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

Attribute Macros