pub enum Either<L, R> {
Left(L),
Right(R),
}Variants§
Implementations§
Source§impl<L, R> Either<L, R>
impl<L, R> Either<L, R>
pub const fn new_left(l: L) -> Self
pub const fn new_right(r: R) -> Self
pub fn split(self) -> (Option<L>, Option<R>)
Sourcepub fn map_left<F, T>(self, f: F) -> Either<T, R>where
F: FnOnce(L) -> T,
pub fn map_left<F, T>(self, f: F) -> Either<T, R>where
F: FnOnce(L) -> T,
Maps Either<L, R> to Either<T, R>
Sourcepub fn map_right<F, T>(self, f: F) -> Either<L, T>where
F: FnOnce(R) -> T,
pub fn map_right<F, T>(self, f: F) -> Either<L, T>where
F: FnOnce(R) -> T,
Maps Either<L, R> to Either<L, T>
pub fn take_left(self) -> Either<L, Self>
pub fn take_right(self) -> Either<R, Self>
pub const fn as_ref(&self) -> Either<&L, &R>
pub const fn as_mut(&mut self) -> Either<&mut L, &mut R>
pub fn left(self) -> Option<L>
pub fn right(self) -> Option<R>
pub fn reverse(self) -> Either<R, L>
pub const fn is_left(&self) -> bool
pub const fn is_right(&self) -> bool
pub fn is_left_and<F>(&self, f: F) -> bool
pub fn is_right_and<F>(&self, f: F) -> bool
Source§impl<T> Either<T, T>
impl<T> Either<T, T>
pub fn into_inner(self) -> T
Trait Implementations§
Source§impl<L, R> TrAnyLeftRight for Either<L, R>
impl<L, R> TrAnyLeftRight for Either<L, R>
type Lt = L
type Rt = R
fn split(self) -> (Option<Self::Lt>, Option<Self::Rt>)
fn map_left<F, T>(self, f: F) -> impl TrAnyLeftRight<Lt = T, Rt = Self::Rt>
fn map_right<F, T>(self, f: F) -> impl TrAnyLeftRight<Lt = Self::Lt, Rt = T>
fn take_left(self) -> SomeOf<Self::Lt, Self>where
Self: Sized,
fn take_right(self) -> SomeOf<Self::Rt, Self>where
Self: Sized,
fn as_ref<'a>( &'a self, ) -> impl TrAnyLeftRight<Lt = &'a Self::Lt, Rt = &'a Self::Rt>
fn as_mut<'a>( &'a mut self, ) -> impl TrAnyLeftRight<Lt = &'a mut Self::Lt, Rt = &'a mut Self::Rt>
fn contains_left(&self) -> bool
fn contains_right(&self) -> bool
fn pick_left(self) -> Option<Self::Lt>where
Self: Sized,
fn pick_right(self) -> Option<Self::Rt>where
Self: Sized,
fn contains_left_and<F>(&self, f: F) -> bool
fn contains_right_and<F>(&self, f: F) -> bool
Source§impl<L, R> TrReverseLeftRight for Either<L, R>
impl<L, R> TrReverseLeftRight for Either<L, R>
impl<L: Copy, R: Copy> Copy for Either<L, R>
Auto Trait Implementations§
impl<L, R> Freeze for Either<L, R>
impl<L, R> RefUnwindSafe for Either<L, R>where
L: RefUnwindSafe,
R: RefUnwindSafe,
impl<L, R> Send for Either<L, R>
impl<L, R> Sync for Either<L, R>
impl<L, R> Unpin for Either<L, R>
impl<L, R> UnsafeUnpin for Either<L, R>where
L: UnsafeUnpin,
R: UnsafeUnpin,
impl<L, R> UnwindSafe for Either<L, R>where
L: UnwindSafe,
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more