Skip to main content

Spawn

Trait Spawn 

Source
pub trait Spawn<T: Future<Item = (), Error = ()>> {
    // Required method
    fn spawn_detached(&self, f: T);
}
Expand description

Value that can spawn a future

On spawn, the executor takes ownership of the future and becomes responsible to call Future::poll() whenever a readiness notification is raised.

Required Methods§

Source

fn spawn_detached(&self, f: T)

Spawns a future to run on this Spawn.

This function will return immediately, and schedule the future f to run on self. The details of scheduling and execution are left to the implementations of Spawn.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: Future<Item = (), Error = ()> + 'static> Spawn<T> for Core

Source§

fn spawn_detached(&self, future: T)

Source§

impl<T: Future<Item = (), Error = ()> + 'static> Spawn<T> for Handle

Source§

fn spawn_detached(&self, future: T)

Source§

impl<T: Future<Item = (), Error = ()> + Send + 'static> Spawn<T> for Remote

Source§

fn spawn_detached(&self, future: T)

Implementors§

Source§

impl<T: Future<Item = (), Error = ()> + Send + 'static> Spawn<T> for NewThread