[][src]Trait futures_ext::FutureExt

pub trait FutureExt: Future + Sized {
    pub fn discard(self) -> Discard<Self> { ... }
pub fn boxify(self) -> BoxFuture<Self::Item, Self::Error>
    where
        Self: 'static + Send
, { ... }
pub fn boxify_nonsend(self) -> BoxFutureNonSend<Self::Item, Self::Error>
    where
        Self: 'static
, { ... }
pub fn left_future<B>(self) -> Either<Self, B> { ... }
pub fn right_future<A>(self) -> Either<A, Self> { ... }
pub fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
    where
        F: FnOnce(&Self::Error),
        Self: Sized
, { ... }
pub fn inspect_result<F>(self, f: F) -> InspectResult<Self, F>
    where
        F: FnOnce(Result<&Self::Item, &Self::Error>),
        Self: Sized
, { ... } }

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

Provided methods

pub fn discard(self) -> Discard<Self>[src]

Map a Future to have Item=() and Error=(). This is useful when a future is being used to drive a computation but the actual results aren't interesting (such as when used with Handle::spawn()).

pub fn boxify(self) -> BoxFuture<Self::Item, Self::Error> where
    Self: 'static + Send
[src]

Create a Sendable boxed version of this Future.

pub fn boxify_nonsend(self) -> BoxFutureNonSend<Self::Item, Self::Error> where
    Self: 'static, 
[src]

Create a non-Sendable boxed version of this Future.

pub fn left_future<B>(self) -> Either<Self, B>[src]

Shorthand for returning future::Either::A

pub fn right_future<A>(self) -> Either<A, Self>[src]

Shorthand for returning future::Either::B

pub fn inspect_err<F>(self, f: F) -> InspectErr<Self, F> where
    F: FnOnce(&Self::Error),
    Self: Sized
[src]

Similar to future::Future::inspect, but runs the function on error

pub fn inspect_result<F>(self, f: F) -> InspectResult<Self, F> where
    F: FnOnce(Result<&Self::Item, &Self::Error>),
    Self: Sized
[src]

Similar to future::Future::inspect, but runs the function on both output or error of the Future treating it as a regular Result

Loading content...

Implementors

impl<T> FutureExt for T where
    T: Future
[src]

Loading content...