linera_core::join_set_ext

Trait JoinSetExt

Source
pub trait JoinSetExt: Sized + Send {
    // Required methods
    fn spawn_task<F: Future<Output: Send> + Send + 'static>(
        &mut self,
        future: F,
    ) -> TaskHandle<F::Output> ;
    fn await_all_tasks(&mut self) -> impl Future<Output = ()> + Send;
    fn reap_finished_tasks(&mut self);
}
Expand description

An extension trait for the JoinSet type.

Required Methods§

Source

fn spawn_task<F: Future<Output: Send> + Send + 'static>( &mut self, future: F, ) -> TaskHandle<F::Output>

Spawns a future task on this JoinSet using JoinSet::spawn.

Returns a oneshot::Receiver to receive the future’s output, and an AbortHandle to cancel execution of the task.

Source

fn await_all_tasks(&mut self) -> impl Future<Output = ()> + Send

Awaits all tasks spawned in this JoinSet.

Source

fn reap_finished_tasks(&mut self)

Reaps tasks that have finished.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§