Trait FutureExt

Source
pub trait FutureExt: Future {
    // Provided method
    fn and_then2<F, B>(self, f: F) -> AndThen2<Self, B::Future, F>
       where B: IntoFuture,
             F: FnOnce(Self::Item) -> B,
             Self: Sized { ... }
}
Expand description

An extension trait that provides a convenient method and_then2.

Provided Methods§

Source

fn and_then2<F, B>(self, f: F) -> AndThen2<Self, B::Future, F>
where B: IntoFuture, F: FnOnce(Self::Item) -> B, Self: Sized,

Creates a future object that resolves into an item that contains a Result of a computation of the provided closure f.

It is very similar to a traditional Future::and_then, but differs in an item’s type.

Might come in handy when you have futures with different error types and you don’t want to collect them into an enum.

Implementors§

Source§

impl<T: Future> FutureExt for T