Skip to main content

AsyncSpawner

Trait AsyncSpawner 

Source
pub trait AsyncSpawner:
    Yielder
    + Copy
    + Send
    + Sync
    + 'static {
    type JoinHandle<F: Send + 'static>: Detach + Future + Send + Sync + 'static;

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

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

A spawner trait for spawning futures.

Required Associated Types§

Source

type JoinHandle<F: Send + 'static>: Detach + Future + Send + Sync + 'static

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

Required Methods§

Source

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

Spawn a future.

Provided Methods§

Source

fn spawn_detach<F>(future: F)
where <F as Future>::Output: Send + 'static, F: Future + Send + 'static,

Spawn a future and detach it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§