TransposeFuture

Trait TransposeFuture 

Source
pub trait TransposeFuture {
    type Output: Future;

    // Required method
    fn transpose(self) -> Self::Output;
}

Required Associated Types§

Required Methods§

Source

fn transpose(self) -> Self::Output

Implementations on Foreign Types§

Source§

impl<F: IntoFuture> TransposeFuture for Option<F>

Source§

fn transpose(self) -> Self::Output

Transpose an Option<impl Future<Output = T>> to an impl Future<Output = Option>

let x: Option<i32> = Some(async {5}).transpose().await;
Source§

type Output = TransposedOption<<F as IntoFuture>::IntoFuture>

Source§

impl<F: IntoFuture, T: Unpin> TransposeFuture for Result<F, T>

Source§

fn transpose(self) -> Self::Output

Transpose an Result<impl Future<Output = T>, E> to an impl Future<Output = Result<T, E>>

let x: Result<i32, ()> = Ok(async {5}).transpose().await;
Source§

type Output = TransposedResult<<F as IntoFuture>::IntoFuture, T>

Implementors§