[−][src]Enum af_lib::iter::EitherOrBoth
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,
[src]
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for EitherOrBoth<A, B> where
A: Send,
B: Send,
[src]
A: Send,
B: Send,
impl<A, B> Sync for EitherOrBoth<A, B> where
A: Sync,
B: Sync,
[src]
A: Sync,
B: Sync,
impl<A, B> Unpin for EitherOrBoth<A, B> where
A: Unpin,
B: Unpin,
[src]
A: Unpin,
B: Unpin,
impl<A, B> UnwindSafe for EitherOrBoth<A, B> where
A: UnwindSafe,
B: UnwindSafe,
[src]
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<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[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<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
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<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[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<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
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>,