pub trait TaskSpawner: Send + Sync + Unpin + Debug + DynClone {
    // Required methods
    fn spawn(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>;
    fn spawn_critical(
        &self,
        name: &'static str,
        fut: BoxFuture<'static, ()>
    ) -> JoinHandle<()>;
    fn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>;
    fn spawn_critical_blocking(
        &self,
        name: &'static str,
        fut: BoxFuture<'static, ()>
    ) -> JoinHandle<()>;
}

Required Methods§

source

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

Spawns the task onto the runtime. See also [Handle::spawn].

source

fn spawn_critical( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>

This spawns a critical task onto the runtime.

source

fn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>

Spawns a blocking task onto the runtime.

source

fn spawn_critical_blocking( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>

This spawns a critical blocking task onto the runtime.

Implementations on Foreign Types§

source§

impl<'a, T: 'a + TaskSpawner + ?Sized> TaskSpawner for &'a T
where &'a T: Send + Sync + Unpin + Debug + DynClone,

source§

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

source§

fn spawn_critical( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>

source§

fn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>

source§

fn spawn_critical_blocking( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>

source§

impl<T: TaskSpawner + ?Sized> TaskSpawner for Arc<T>
where Arc<T>: Send + Sync + Unpin + Debug + DynClone,

source§

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

source§

fn spawn_critical( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>

source§

fn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>

source§

fn spawn_critical_blocking( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>

Implementors§