Trait TaskSpawner

Source
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§