pub enum Either<A, B> {
A(A),
B(B),
}
Variants§
Implementations§
Source§impl<A, B> Either<A, B>
impl<A, B> Either<A, B>
pub fn is_a(&self) -> bool
pub fn is_b(&self) -> bool
pub fn map_a<U, F>(self, f: F) -> Either<U, B>where
F: FnOnce(A) -> U,
pub fn map_b<U, F>(self, f: F) -> Either<A, U>where
F: FnOnce(B) -> U,
pub fn try_map_a<U, E, F>(self, f: F) -> Result<Either<U, B>, E>
pub fn try_map_b<U, E, F>(self, f: F) -> Result<Either<A, U>, E>
pub fn unwrap_a(self) -> A
pub fn unwrap_b(self) -> B
Trait Implementations§
impl<A, B> StructuralPartialEq for Either<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Either<A, B>
impl<A, B> RefUnwindSafe for Either<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Either<A, B>
impl<A, B> Sync for Either<A, B>
impl<A, B> Unpin for Either<A, B>
impl<A, B> UnwindSafe for Either<A, B>where
A: UnwindSafe,
B: 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