Trait cm_util::abortable_scope::AbortFutureExt
source · pub trait AbortFutureExt<T>: Future<Output = T> + Send {
// Required method
fn with(
self,
scope: &AbortableScope
) -> impl Future<Output = Result<T, AbortError>>;
}
Required Methods§
sourcefn with(
self,
scope: &AbortableScope
) -> impl Future<Output = Result<T, AbortError>>
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.