Trait FutureExt
pub trait FutureExt: Future
A trait which contains a variety of convenient adapters and utilities for Futures.
Provided Methods
fn with_cancellation_token(self, cancellation_token: &CancellationToken) -> WithCancellationTokenFuture<'_, Self> where Self: Sized,Similar to
CancellationToken::run_until_cancelled, but with the advantage that it is easier to write fluent call chains.Fairness
Calling this on an already-cancelled token directly returns
None. For all subsequent polls, in case of concurrent completion and cancellation, this is biased towards theselffuture completion.Examples
use oneshot; use FutureExt; use CancellationToken; # asyncfn with_cancellation_token_owned(self, cancellation_token: CancellationToken) -> WithCancellationTokenFutureOwned<Self> where Self: Sized,Similar to
CancellationToken::run_until_cancelled_owned, but with the advantage that it is easier to write fluent call chains.Fairness
Calling this on an already-cancelled token directly returns
None. For all subsequent polls, in case of concurrent completion and cancellation, this is biased towards theselffuture completion.Examples
use oneshot; use FutureExt; use CancellationToken; # async
Implementors
impl<T> FutureExt for Either<L, R> where T: Future + ?Sized,impl<T> FutureExt for ReusableBoxFuture<'a, T> where T: Future + ?Sized,impl<T> FutureExt for WaitForCancellationFuture<'a> where T: Future + ?Sized,impl<T> FutureExt for WaitForCancellationFutureOwned where T: Future + ?Sized,impl<T> FutureExt for WriteAllVectored<'a, 'b, W> where T: Future + ?Sized,impl<T: Future + ?Sized> FutureExt for T