Skip to main content

JoinSetLike

Trait JoinSetLike 

Source
pub trait JoinSetLike<T>: Send {
    // Required methods
    fn spawn<F>(&mut self, future: F)
       where F: Future<Output = T> + Send + 'static;
    fn join_next(
        &mut self,
    ) -> impl Future<Output = Option<Result<T, JoinError>>> + Send + '_;
    fn abort_all(&mut self);
}
Expand description

A handle that yields a task’s result on await and supports abort. Matches tokio::task::JoinSet’s shape.

Required Methods§

Source

fn spawn<F>(&mut self, future: F)
where F: Future<Output = T> + Send + 'static,

Spawn a future onto the set. The future is Send + 'static because it crosses task boundaries.

Source

fn join_next( &mut self, ) -> impl Future<Output = Option<Result<T, JoinError>>> + Send + '_

Resolve the next completed task, or None if the set is empty. JoinError wraps the panic / cancellation outcome.

Source

fn abort_all(&mut self)

Abort every spawned task. Subsequent join_next calls drain the cancellation outcomes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§