Enum actix_utils::future::Either[][src]

pub enum Either<L, R> {
    Left {
        value: L,
    },
    Right {
        value: R,
    },
}

Combines two different futures that have the same output type.

Construct variants with Either::left and Either::right.

Examples

use actix_utils::future::{ready, Ready, Either};

let res = Either::<_, Ready<usize>>::left(ready(42));
assert_eq!(res.await, 42);

let res = Either::<Ready<usize>, _>::right(ready(43));
assert_eq!(res.await, 43);

Variants

Left

A value of type L.

Fields of Left

value: L
Right

A value of type R.

Fields of Right

value: R

Implementations

impl<L, R> Either<L, R>[src]

pub fn left(value: L) -> Either<L, R>

Notable traits for Either<L, R>

impl<L, R> Future for Either<L, R> where
    L: Future,
    R: Future<Output = L::Output>, 
type Output = L::Output;
[src]

Creates new Either using left variant.

pub fn right(value: R) -> Either<L, R>

Notable traits for Either<L, R>

impl<L, R> Future for Either<L, R> where
    L: Future,
    R: Future<Output = L::Output>, 
type Output = L::Output;
[src]

Creates new Either using right variant.

impl<T> Either<T, T>[src]

pub fn into_inner(self) -> T[src]

Unwraps into inner value when left and right have a common type.

Trait Implementations

impl<L: Clone, R: Clone> Clone for Either<L, R>[src]

impl<L: Debug, R: Debug> Debug for Either<L, R>[src]

impl<L, R> Future for Either<L, R> where
    L: Future,
    R: Future<Output = L::Output>, 
[src]

type Output = L::Output

The type of value produced on completion.

impl<'__pin, L, R> Unpin for Either<L, R> where
    __Origin<'__pin, L, R>: Unpin
[src]

Auto Trait Implementations

impl<L, R> RefUnwindSafe for Either<L, R> where
    L: RefUnwindSafe,
    R: RefUnwindSafe

impl<L, R> Send for Either<L, R> where
    L: Send,
    R: Send

impl<L, R> Sync for Either<L, R> where
    L: Sync,
    R: Sync

impl<L, R> UnwindSafe for Either<L, R> where
    L: UnwindSafe,
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.