Trait mz_ore::task::JoinHandleExt
source · 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§
sourcefn wait_and_assert_finished<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>where
Self: 'async_trait,
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.