pub enum Or2<T1, T2> {
T1(T1),
T2(T2),
}
Expand description
Or2
is an enum representing a value that can be either of 2 types, T1 … T2.
Variants§
Implementations§
Source§impl<T1, T2> Or2<T1, T2>
impl<T1, T2> Or2<T1, T2>
Sourcepub fn as_t1(self) -> Option<T1>
pub fn as_t1(self) -> Option<T1>
Converts the enum to an Option containing the T1 value, if it is of type T1.
Sourcepub fn as_t2(self) -> Option<T2>
pub fn as_t2(self) -> Option<T2>
Converts the enum to an Option containing the T2 value, if it is of type T2.
Sourcepub fn map_t1<F, B>(self, f: F) -> Or2<B, T2>where
F: FnOnce(T1) -> B,
pub fn map_t1<F, B>(self, f: F) -> Or2<B, T2>where
F: FnOnce(T1) -> B,
Transforms the T1 value of the enum using a provided function, maintaining other types as is.
Auto Trait Implementations§
impl<T1, T2> Freeze for Or2<T1, T2>
impl<T1, T2> RefUnwindSafe for Or2<T1, T2>where
T1: RefUnwindSafe,
T2: RefUnwindSafe,
impl<T1, T2> Send for Or2<T1, T2>
impl<T1, T2> Sync for Or2<T1, T2>
impl<T1, T2> Unpin for Or2<T1, T2>
impl<T1, T2> UnwindSafe for Or2<T1, T2>where
T1: UnwindSafe,
T2: 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