pub trait FutureSpawner: Send + Sync + 'static {
    // Required method
    fn spawn<T: Future<Output = ()> + Send + 'static>(&self, future: T);
}
Expand description

A generic trait which is able to spawn futures in the background.

If the tokio feature is enabled, this is implemented on TokioSpawner struct which delegates to tokio::spawn().

Required Methods§

source

fn spawn<T: Future<Output = ()> + Send + 'static>(&self, future: T)

Spawns the given future as a background task.

This method MUST NOT block on the given future immediately.

Implementors§

source§

impl FutureSpawner for TokioSpawner

Available on crate feature tokio only.