Trait Spawner

Source
pub trait Spawner {
    // Required methods
    fn spawn(&mut self, fut: BoxFuture<'static, ()>) -> Result<()>;
    fn spawn_local(&mut self, fut: LocalBoxFuture<'static, ()>) -> Result<()>;
    fn block(&mut self, f: Box<dyn FnOnce() + Send + 'static>) -> Result<()>;
}
Expand description

The value for spawning cases.

Required Methods§

Source

fn spawn(&mut self, fut: BoxFuture<'static, ()>) -> Result<()>

Spawn a task to execute a case.

Source

fn spawn_local(&mut self, fut: LocalBoxFuture<'static, ()>) -> Result<()>

Spawn a task to execute a case onto the current thread.

Source

fn block(&mut self, f: Box<dyn FnOnce() + Send + 'static>) -> Result<()>

Spawn a task to execute a case which may block the running thread.

Implementations on Foreign Types§

Source§

impl<T> Spawner for &mut T
where T: Spawner + ?Sized,

Source§

fn spawn(&mut self, fut: BoxFuture<'static, ()>) -> Result<()>

Source§

fn spawn_local(&mut self, fut: LocalBoxFuture<'static, ()>) -> Result<()>

Source§

fn block(&mut self, f: Box<dyn FnOnce() + Send + 'static>) -> Result<()>

Source§

impl<T> Spawner for Box<T>
where T: Spawner + ?Sized,

Source§

fn spawn(&mut self, fut: BoxFuture<'static, ()>) -> Result<()>

Source§

fn spawn_local(&mut self, fut: LocalBoxFuture<'static, ()>) -> Result<()>

Source§

fn block(&mut self, f: Box<dyn FnOnce() + Send + 'static>) -> Result<()>

Implementors§