Trait futures::task::Spawn[][src]

pub trait Spawn {
    fn spawn_obj(
        &self,
        future: FutureObj<'static, ()>
    ) -> Result<(), SpawnError>; fn status(&self) -> Result<(), SpawnError> { ... } }
Expand description

The Spawn trait allows for pushing futures onto an executor that will run them to completion.

Required methods

fn spawn_obj(&self, future: FutureObj<'static, ()>) -> Result<(), SpawnError>[src]

Expand description

Spawns a future that will be run to completion.

Errors

The executor may be unable to spawn tasks. Spawn errors should represent relatively rare scenarios, such as the executor having been shut down so that it is no longer able to accept tasks.

Loading content...

Provided methods

fn status(&self) -> Result<(), SpawnError>[src]

Expand description

Determines whether the executor is able to spawn new tasks.

This method will return Ok when the executor is likely (but not guaranteed) to accept a subsequent spawn attempt. Likewise, an Err return means that spawn is likely, but not guaranteed, to yield an error.

Loading content...

Implementations on Foreign Types

impl<Sp> Spawn for Rc<Sp> where
    Sp: Spawn + ?Sized
[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

pub fn status(&self) -> Result<(), SpawnError>[src]

impl<'_, Sp> Spawn for &'_ Sp where
    Sp: Spawn + ?Sized
[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

pub fn status(&self) -> Result<(), SpawnError>[src]

impl<Sp> Spawn for Box<Sp, Global> where
    Sp: Spawn + ?Sized
[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

pub fn status(&self) -> Result<(), SpawnError>[src]

impl<'_, Sp> Spawn for &'_ mut Sp where
    Sp: Spawn + ?Sized
[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

pub fn status(&self) -> Result<(), SpawnError>[src]

impl<Sp> Spawn for Arc<Sp> where
    Sp: Spawn + ?Sized
[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

pub fn status(&self) -> Result<(), SpawnError>[src]

Loading content...

Implementors

impl Spawn for LocalSpawner[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

pub fn status(&self) -> Result<(), SpawnError>[src]

impl Spawn for ThreadPool[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

impl<'_> Spawn for FuturesUnordered<FutureObj<'_, ()>>[src]

pub fn spawn_obj(
    &self,
    future_obj: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

impl<Ex> Spawn for Executor01As03<Ex> where
    Ex: Executor<Compat<UnitError<FutureObj<'static, ()>>>> + Clone + Send + 'static, 
[src]

pub fn spawn_obj(
    &self,
    future: FutureObj<'static, ()>
) -> Result<(), SpawnError>
[src]

Loading content...