Trait agnostic_lite::AsyncBlockingSpawner
source · pub trait AsyncBlockingSpawner: Copy + 'static {
type JoinHandle<R>: Detach + Send
where R: Send + 'static;
// Required method
fn spawn_blocking<F, R>(f: F) -> Self::JoinHandle<R>
where F: FnOnce() -> R + Send + 'static,
R: Send + 'static;
// Provided method
fn spawn_blocking_detach<F, R>(f: F)
where F: FnOnce() -> R + Send + 'static,
R: Send + 'static { ... }
}Expand description
A spawner trait for spawning blocking.
Required Associated Types§
sourcetype JoinHandle<R>: Detach + Send
where
R: Send + 'static
type JoinHandle<R>: Detach + Send where R: Send + 'static
The join handle type for blocking tasks
Required Methods§
sourcefn spawn_blocking<F, R>(f: F) -> Self::JoinHandle<R>
fn spawn_blocking<F, R>(f: F) -> Self::JoinHandle<R>
Spawn a blocking function onto the runtime
Provided Methods§
sourcefn spawn_blocking_detach<F, R>(f: F)
fn spawn_blocking_detach<F, R>(f: F)
Spawn a blocking function onto the runtime and detach it
Object Safety§
This trait is not object safe.
Implementors§
source§impl AsyncBlockingSpawner for AsyncStdSpawner
Available on crate feature async-std only.
impl AsyncBlockingSpawner for AsyncStdSpawner
Available on crate feature
async-std only.type JoinHandle<R> = JoinHandle<R> where R: Send + 'static
source§impl AsyncBlockingSpawner for SmolSpawner
Available on crate feature smol only.
impl AsyncBlockingSpawner for SmolSpawner
Available on crate feature
smol only.type JoinHandle<R> = Task<R> where R: Send + 'static
source§impl AsyncBlockingSpawner for TokioSpawner
Available on crate feature tokio only.
impl AsyncBlockingSpawner for TokioSpawner
Available on crate feature
tokio only.type JoinHandle<R> = JoinHandle<R> where R: Send + 'static
source§impl AsyncBlockingSpawner for WasmSpawner
Available on crate feature wasm only.
impl AsyncBlockingSpawner for WasmSpawner
Available on crate feature
wasm only.