pub enum Either<A, B> {
Left(A),
Right(B),
}Expand description
Combines two different futures, streams, or sinks having the same associated types into a single type.
Variants
Left(A)
First branch of the type
Right(B)
Second branch of the type
Implementations
sourceimpl<A, B> Either<A, B>
impl<A, B> Either<A, B>
sourceimpl<T> Either<T, T>
impl<T> Either<T, T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Extract the value of an either over two equivalent types.
Trait Implementations
sourceimpl<A: Clone, B: Clone> Clone for Either<A, B>
impl<A: Clone, B: Clone> Clone for Either<A, B>
sourcefn clone(&self) -> Either<A, B>ⓘNotable traits for Either<A, B>impl<A, B> Future for Either<A, B> where
A: Future,
B: Future<Output = A::Output>, type Output = A::Output;
fn clone(&self) -> Either<A, B>ⓘNotable traits for Either<A, B>impl<A, B> Future for Either<A, B> where
A: Future,
B: Future<Output = A::Output>, type Output = A::Output;
A: Future,
B: Future<Output = A::Output>, type Output = A::Output;
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<A, B> Error for Either<A, B> where
A: Error,
B: Error,
impl<A, B> Error for Either<A, B> where
A: Error,
B: Error,
Either implements Error if both A and B implement it.
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl<A: Ord, B: Ord> Ord for Either<A, B>
impl<A: Ord, B: Ord> Ord for Either<A, B>
sourceimpl<A: PartialOrd, B: PartialOrd> PartialOrd<Either<A, B>> for Either<A, B>
impl<A: PartialOrd, B: PartialOrd> PartialOrd<Either<A, B>> for Either<A, B>
sourcefn partial_cmp(&self, other: &Either<A, B>) -> Option<Ordering>
fn partial_cmp(&self, other: &Either<A, B>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<A: Copy, B: Copy> Copy for Either<A, B>
impl<A: Eq, B: Eq> Eq for Either<A, B>
impl<A, B> StructuralEq for Either<A, B>
impl<A, B> StructuralPartialEq for Either<A, B>
Auto Trait Implementations
impl<A, B> RefUnwindSafe for Either<A, B> where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Either<A, B> where
A: Send,
B: Send,
impl<A, B> Sync for Either<A, B> where
A: Sync,
B: Sync,
impl<A, B> Unpin for Either<A, B> where
A: Unpin,
B: Unpin,
impl<A, B> UnwindSafe for Either<A, B> where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for F where
F: Future,
impl<F> IntoFuture for F where
F: Future,
type Output = <F as Future>::Output
type Output = <F as Future>::Output
into_future)The output that the future will produce on completion.
type Future = F
type Future = F
into_future)Which kind of future are we turning this into?
sourcepub fn into_future(self) -> <F as IntoFuture>::Future
pub fn into_future(self) -> <F as IntoFuture>::Future
into_future)Creates a future from a value.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more