FbTryFutureExt

Trait FbTryFutureExt 

Source
pub trait FbTryFutureExt: Future {
    // Provided methods
    fn try_shared(self) -> TryShared<Self>
       where Self: TryFuture<Error = Error> + Sized,
             <Self as TryFuture>::Ok: Clone { ... }
    fn flatten_err<I, E1, E2>(
        self,
    ) -> Map<Self, fn(Result<Result<I, E1>, E2>) -> Result<I, E1>>
       where Self: Sized + Future<Output = Result<Result<I, E1>, E2>>,
             E1: From<E2> { ... }
}
Expand description

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

Provided Methods§

Source

fn try_shared(self) -> TryShared<Self>
where Self: TryFuture<Error = Error> + Sized, <Self as TryFuture>::Ok: Clone,

Create a cloneable handle to this future where all handles will resolve to the same result.

Similar to futures::future::Shared, but instead works on Futures returning Result where Err is anyhow::Error. This is achieved by storing anyhow::Error in std::sync::Arc.

Source

fn flatten_err<I, E1, E2>( self, ) -> Map<Self, fn(Result<Result<I, E1>, E2>) -> Result<I, E1>>
where Self: Sized + Future<Output = Result<Result<I, E1>, E2>>, E1: From<E2>,

Convert a Future of Result<Result<I, E1>, E2> into a Future of Result<I, E1>, assuming E2 can convert into E1.

Implementors§

Source§

impl<T> FbTryFutureExt for T
where T: TryFuture + ?Sized,