pub trait AbortFutureExt<T>: Future<Output = T> + Send {
    // Required method
    fn with(
        self,
        scope: &AbortableScope
    ) -> impl Future<Output = Result<T, AbortError>>;
}

Required Methods§

source

fn with( self, scope: &AbortableScope ) -> impl Future<Output = Result<T, AbortError>>

Causes the future to complete with an [InterruptError] if the scope is aborted.

Syntax sugar for scope.run(future):

let (scope, handle) = AbortableScope::new();
handle.abort();
some_future.with(&scope).await;   // Result<T, InterruptError>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Fut, T> AbortFutureExt<T> for Fut
where Fut: Future<Output = T> + Send,