pub trait AsyncLocalSpawner: Copy + 'static {
    type JoinHandle<F>: Detach + Future + 'static
       where F: 'static;

    // Required method
    fn spawn_local<F>(future: F) -> Self::JoinHandle<F::Output>
       where F::Output: 'static,
             F: Future + 'static;

    // Provided method
    fn spawn_local_detach<F>(future: F)
       where F::Output: 'static,
             F: Future + 'static { ... }
}
Expand description

A spawner trait for spawning futures.

Required Associated Types§

source

type JoinHandle<F>: Detach + Future + 'static where F: 'static

The handle returned by the spawner when a future is spawned.

Required Methods§

source

fn spawn_local<F>(future: F) -> Self::JoinHandle<F::Output>
where F::Output: 'static, F: Future + 'static,

Spawn a future.

Provided Methods§

source

fn spawn_local_detach<F>(future: F)
where F::Output: 'static, F: Future + 'static,

Spawn a future and detach it.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl AsyncLocalSpawner for AsyncStdSpawner

Available on crate feature async-std only.
§

type JoinHandle<F> = JoinHandle<F> where F: 'static

source§

impl AsyncLocalSpawner for SmolSpawner

Available on crate feature smol only.
§

type JoinHandle<F> = Task<F> where F: 'static

source§

impl AsyncLocalSpawner for TokioSpawner

Available on crate feature tokio only.
§

type JoinHandle<F> = JoinHandle<F> where F: 'static

source§

impl AsyncLocalSpawner for WasmSpawner

Available on crate feature wasm only.
§

type JoinHandle<F> = WasmJoinHandle<F> where F: 'static