pub trait JoinHandleExt<T>: Future<Output = Result<T, JoinError>> {
    // Required methods
    fn wait_and_assert_finished<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn abort_and_wait<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Available on crate feature async only.
Expand description

Extension methods for JoinHandle and AbortOnDropHandle.

Required Methods§

source

fn wait_and_assert_finished<'async_trait>( self ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
where Self: 'async_trait,

Waits for the task to finish, resuming the unwind if the task panicked.

Because this takes ownership of self, and JoinHandle and AbortOnDropHandle don’t offer abort methods, this can avoid worrying about aborted tasks.

source

fn abort_and_wait<'async_trait>( self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,

Aborts the task, then waits for it to complete.

Implementations on Foreign Types§

source§

impl<T: Send, J: JoinHandleExt<T> + Send> JoinHandleExt<T> for Instrumented<J>

source§

fn wait_and_assert_finished<'async_trait>( self ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
where Self: 'async_trait,

source§

fn abort_and_wait<'async_trait>( self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,

Implementors§