Enum actix_utils::future::Either
source · [−]pub enum Either<L, R> {
Left {
value: L,
},
Right {
value: R,
},
}
Expand description
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
.
Right
A value of type R
.
Implementations
sourceimpl<L, R> Either<L, R>
impl<L, R> Either<L, R>
sourceimpl<T> Either<T, T>
impl<T> Either<T, T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps into inner value when left and right have a common type.
Trait Implementations
sourceimpl<L: Clone, R: Clone> Clone for Either<L, R>
impl<L: Clone, R: Clone> Clone for Either<L, R>
sourcefn clone(&self) -> 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;
fn clone(&self) -> 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;
L: Future,
R: Future<Output = L::Output>, type Output = L::Output;
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<'__pin, L, R> Unpin for Either<L, R>where
__Origin<'__pin, L, R>: Unpin,
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
sourcefn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more