Trait linera_core::join_set_ext::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§
sourcefn spawn_task<F: Future<Output: Send> + Send + 'static>(
&mut self,
future: F,
) -> TaskHandle<F::Output> ⓘ
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.
sourcefn await_all_tasks(&mut self) -> impl Future<Output = ()> + Send
fn await_all_tasks(&mut self) -> impl Future<Output = ()> + Send
Awaits all tasks spawned in this JoinSet
.
sourcefn reap_finished_tasks(&mut self)
fn reap_finished_tasks(&mut self)
Reaps tasks that have finished.
Object Safety§
This trait is not object safe.