Skip to main content

TaskSpawner

Trait TaskSpawner 

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

A trait for spawning a future onto an asynchronous runtime.

Required Methods§

Source

fn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>)

Spawns a type-erased future.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl TaskSpawner for TokioSpawner

Available on crate feature tokio only.