gloo_worker/oneshot/
mod.rs

1//! A future-based worker that for each input, one output is produced.
2//!
3//! ## Example
4//!
5//! ```rust, no_run
6//! use gloo_worker::oneshot::oneshot;
7//! use gloo_worker::Spawnable;
8//!
9//! #[oneshot]
10//! async fn Squared(input: u32) -> u32 {
11//!     input.pow(2)
12//! }
13//!
14//! # async {
15//! // consuming the worker
16//! let mut squared_bridge = Squared::spawner().spawn("...");
17//! assert_eq!(squared_bridge.run(2).await, 4);
18//! # };
19//! ```
20
21mod bridge;
22mod registrar;
23mod spawner;
24mod traits;
25mod worker;
26
27pub use bridge::OneshotBridge;
28pub use registrar::OneshotRegistrar;
29pub use spawner::OneshotSpawner;
30pub use traits::Oneshot;
31
32/// Creates an oneshot worker.
33///
34/// See [module level documentation](self) for more information.
35#[doc(inline)]
36#[cfg(feature = "futures")]
37pub use gloo_worker_macros::oneshot;