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.
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.