Enum otter_api_tests::EitherOrBoth [−][src]
pub enum EitherOrBoth<A, B> {
Both(A, B),
Left(A),
Right(B),
}Value that either holds a single A or B, or both.
Variants
Both values are present.
Only the left value of type A is present.
Only the right value of type B is present.
Implementations
impl<A, B> EitherOrBoth<A, B>[src]
pub fn has_left(&self) -> bool[src]
If Left, or Both, return true, otherwise, return false.
pub fn has_right(&self) -> bool[src]
If Right, or Both, return true, otherwise, return false.
pub fn is_left(&self) -> bool[src]
If Left, return true otherwise, return false.
Exclusive version of [has_left].
pub fn is_right(&self) -> bool[src]
If Right, return true otherwise, return false.
Exclusive version of [has_right].
pub fn is_both(&self) -> bool[src]
If Right, return true otherwise, return false.
Equivalent to self.as_ref().both().is_some().
pub fn left(self) -> Option<A>[src]
If Left, or Both, return Some with the left value, otherwise, return None.
pub fn right(self) -> Option<B>[src]
If Right, or Both, return Some with the right value, otherwise, return None.
pub fn both(self) -> Option<(A, B)>[src]
If Both, return Some tuple containing left and right.
pub fn as_ref(&self) -> EitherOrBoth<&A, &B>[src]
Converts from &EitherOrBoth<A, B> to EitherOrBoth<&A, &B>.
pub fn as_mut(&mut self) -> EitherOrBoth<&mut A, &mut B>[src]
Converts from &mut EitherOrBoth<A, B> to EitherOrBoth<&mut A, &mut B>.
pub fn flip(self) -> EitherOrBoth<B, A>[src]
Convert EitherOrBoth<A, B> to EitherOrBoth<B, A>.
pub fn map_left<F, M>(self, f: F) -> EitherOrBoth<M, B> where
F: FnOnce(A) -> M, [src]
F: FnOnce(A) -> M,
Apply the function f on the value a in Left(a) or Both(a, b) variants. If it is
present rewrapping the result in self’s original variant.
pub fn map_right<F, M>(self, f: F) -> EitherOrBoth<A, M> where
F: FnOnce(B) -> M, [src]
F: FnOnce(B) -> M,
Apply the function f on the value b in Right(b) or Both(a, b) variants.
If it is present rewrapping the result in self’s original variant.
pub fn map_any<F, L, G, R>(self, f: F, g: G) -> EitherOrBoth<L, R> where
F: FnOnce(A) -> L,
G: FnOnce(B) -> R, [src]
F: FnOnce(A) -> L,
G: FnOnce(B) -> R,
Apply the functions f and g on the value a and b respectively;
found in Left(a), Right(b), or Both(a, b) variants.
The Result is rewrapped self’s original variant.
pub fn left_and_then<F, L>(self, f: F) -> EitherOrBoth<L, B> where
F: FnOnce(A) -> EitherOrBoth<L, B>, [src]
F: FnOnce(A) -> EitherOrBoth<L, B>,
Apply the function f on the value b in Right(b) or Both(a, _) variants if it is
present.
pub fn right_and_then<F, R>(self, f: F) -> EitherOrBoth<A, R> where
F: FnOnce(B) -> EitherOrBoth<A, R>, [src]
F: FnOnce(B) -> EitherOrBoth<A, R>,
Apply the function f on the value a
in Left(a) or Both(a, _) variants if it is present.
impl<T> EitherOrBoth<T, T>[src]
pub fn reduce<F>(self, f: F) -> T where
F: FnOnce(T, T) -> T, [src]
F: FnOnce(T, T) -> T,
Return either value of left, right, or the product of f applied where Both are present.
Trait Implementations
impl<A, B> Clone for EitherOrBoth<A, B> where
B: Clone,
A: Clone, [src]
B: Clone,
A: Clone,
pub fn clone(&self) -> EitherOrBoth<A, B>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<A, B> Debug for EitherOrBoth<A, B> where
B: Debug,
A: Debug, [src]
B: Debug,
A: Debug,
impl<A, B> Eq for EitherOrBoth<A, B> where
B: Eq,
A: Eq, [src]
B: Eq,
A: Eq,
impl<A, B> Hash for EitherOrBoth<A, B> where
B: Hash,
A: Hash, [src]
B: Hash,
A: Hash,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher, [src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<A, B> Into<Option<Either<A, B>>> for EitherOrBoth<A, B>[src]
impl<A, B> PartialEq<EitherOrBoth<A, B>> for EitherOrBoth<A, B> where
B: PartialEq<B>,
A: PartialEq<A>, [src]
B: PartialEq<B>,
A: PartialEq<A>,
pub fn eq(&self, other: &EitherOrBoth<A, B>) -> bool[src]
pub fn ne(&self, other: &EitherOrBoth<A, B>) -> bool[src]
impl<A, B> StructuralEq for EitherOrBoth<A, B>[src]
impl<A, B> StructuralPartialEq for EitherOrBoth<A, B>[src]
Auto Trait Implementations
impl<A, B> RefUnwindSafe for EitherOrBoth<A, B> where
A: RefUnwindSafe,
B: RefUnwindSafe,
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for EitherOrBoth<A, B> where
A: Send,
B: Send,
A: Send,
B: Send,
impl<A, B> Sync for EitherOrBoth<A, B> where
A: Sync,
B: Sync,
A: Sync,
B: Sync,
impl<A, B> Unpin for EitherOrBoth<A, B> where
A: Unpin,
B: Unpin,
A: Unpin,
B: Unpin,
impl<A, B> UnwindSafe for EitherOrBoth<A, B> where
A: UnwindSafe,
B: UnwindSafe,
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
Notable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<A> DynCastExt for A
pub fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
T: ?Sized,
A: DynCastExtHelper<T>,
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
T: ?Sized,
A: DynCastExtHelper<T>,
pub fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
T: ?Sized,
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
pub fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
T: ?Sized,
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
T: ?Sized,
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
pub fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,