pub trait FbFutureExt: Future {
    // Provided methods
    fn timeout(self, timeout: Duration) -> Timeout<Self>
       where Self: Sized { ... }
    fn on_cancel<F: FnOnce()>(self, on_cancel: F) -> OnCancel<Self, F> 
       where Self: Sized { ... }
    fn on_cancel_with_data<F>(self, on_cancel: F) -> OnCancelWithData<Self, F> 
       where Self: Sized + CancelData,
             F: FnOnce(Self::Data) { ... }
}
Expand description

A trait implemented by default for all Futures which extends the standard functionality.

Provided Methods§

source

fn timeout(self, timeout: Duration) -> Timeout<Self>
where Self: Sized,

Construct a new tokio::time::Timeout.

source

fn on_cancel<F: FnOnce()>(self, on_cancel: F) -> OnCancel<Self, F>
where Self: Sized,

Call the on_cancel callback if this future is canceled (dropped without completion).

source

fn on_cancel_with_data<F>(self, on_cancel: F) -> OnCancelWithData<Self, F>
where Self: Sized + CancelData, F: FnOnce(Self::Data),

Call the on_cancel callback if this future is canceled (dropped without completion). Pass additional data extracted from the inner future via the CancelData trait.

Implementors§

source§

impl<T> FbFutureExt for T
where T: Future + ?Sized,