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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.