Trait agnostic_lite::AsyncSpawner
source · pub trait AsyncSpawner: Copy + Send + Sync + 'static {
type JoinHandle<F>: Detach + Future + Send + Sync + 'static
where F: Send + 'static;
// Required methods
fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>
where F::Output: Send + 'static,
F: Future + Send + 'static,
<<Self as AsyncSpawner>::JoinHandle<F> as Future>::Output: Send;
fn spawn_detach<F>(future: F)
where F::Output: Send + 'static,
F: Future + Send + 'static;
}Expand description
A spawner trait for spawning futures.
Required Associated Types§
Required Methods§
sourcefn spawn<F>(future: F) -> Self::JoinHandle<F::Output>where
F::Output: Send + 'static,
F: Future + Send + 'static,
<<Self as AsyncSpawner>::JoinHandle<F> as Future>::Output: Send,
fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>where
F::Output: Send + 'static,
F: Future + Send + 'static,
<<Self as AsyncSpawner>::JoinHandle<F> as Future>::Output: Send,
Spawn a future.
Object Safety§
This trait is not object safe.
Implementors§
source§impl AsyncSpawner for AsyncStdSpawner
Available on crate feature async-std only.
impl AsyncSpawner for AsyncStdSpawner
Available on crate feature
async-std only.type JoinHandle<F> = JoinHandle<F> where F: Send + 'static
source§impl AsyncSpawner for SmolSpawner
Available on crate feature smol only.
impl AsyncSpawner for SmolSpawner
Available on crate feature
smol only.type JoinHandle<F> = Task<F> where F: Send + 'static
source§impl AsyncSpawner for TokioSpawner
Available on crate feature tokio only.
impl AsyncSpawner for TokioSpawner
Available on crate feature
tokio only.type JoinHandle<F> = JoinHandle<F> where F: Send + 'static
source§impl AsyncSpawner for WasmSpawner
Available on crate feature wasm only.
impl AsyncSpawner for WasmSpawner
Available on crate feature
wasm only.