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

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

    // Provided method
    fn spawn_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>: Future + 'static where F: 'static

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

Required Methods§

source

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

Spawn a future.

Provided Methods§

source

fn spawn_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§