pub struct Either<L, R> { /* private fields */ }
Expand description
A struct representing either a left value, or a right value.
Implementations§
source§impl<L, R> Either<L, R>
impl<L, R> Either<L, R>
sourcepub fn left(self) -> Option<L>
pub fn left(self) -> Option<L>
Extract the left value from the Either
.
This consumes the either in the process.
let left: Either<u16, u16> = Either::new_left(10);
assert_eq!(left.left(), Some(10));
let right: Either<u16, u16> = Either::new_right(10);
assert!(right.left().is_none());
sourcepub fn left_safe(self) -> Result<L>
pub fn left_safe(self) -> Result<L>
Extract the left value from the Either
.
This consumes the either in the process.
If this is performed on a Right
variant, an
error returned.
Errors
let left: Either<u16, u16> = Either::new_left(10);
assert_eq!(left.left_safe()?, 10);
let right: Either<u16, u16> = Either::new_right(10);
assert!(right.left_safe().is_err());
sourcepub fn right(self) -> Option<R>
pub fn right(self) -> Option<R>
Extract the right value from the Either
.
This consumes the either in the process.
let right: Either<u16, u16> = Either::new_right(10);
assert_eq!(right.right(), Some(10));
let left: Either<u16, u16> = Either::new_left(10);
assert!(left.right().is_none());
sourcepub fn right_safe(self) -> Result<R>
pub fn right_safe(self) -> Result<R>
Extract the right value from the Either
.
This consumes the either in the process.
If this is performed on a Left
variant, an
error returned.
Errors
let right: Either<u16, u16> = Either::new_right(10);
assert_eq!(right.right_safe()?, 10);
let left: Either<u16, u16> = Either::new_left(10);
assert!(left.right_safe().is_err());
sourcepub fn is_left(&self) -> bool
pub fn is_left(&self) -> bool
Check if this Either
is the left variant.
let left: Either<&str, &str> = Either::new_left("lefty");
assert!(left.is_left());
assert!(!left.is_right());
sourcepub fn is_right(&self) -> bool
pub fn is_right(&self) -> bool
Check if this Either
is the right variant.
let right: Either<&str, &str> = Either::new_right("righty");
assert!(right.is_right());
assert!(!right.is_left());
sourcepub fn left_ref(&self) -> Result<&L>
pub fn left_ref(&self) -> Result<&L>
Extract a reference to the left value.
Errors
let left: Either<&str, &str> = Either::new_left("lefty");
assert_eq!(left.left_ref()?, &"lefty");
sourcepub fn right_ref(&self) -> Result<&R>
pub fn right_ref(&self) -> Result<&R>
Extract a reference to the right value.
Errors
let right: Either<&str, &str> = Either::new_right("righty");
assert_eq!(right.right_ref()?, &"righty");
sourcepub fn left_mut(&mut self) -> Result<&mut L>
pub fn left_mut(&mut self) -> Result<&mut L>
Extract a mutable reference to the left value.
Errors
let mut left: Either<&str, &str> = Either::new_left("lefty");
assert_eq!(left.left_ref()?, &"lefty");
*(left.left_mut()?) = "left handed";
assert_eq!(left.left_ref()?, &"left handed");
sourcepub fn right_mut(&mut self) -> Result<&mut R>
pub fn right_mut(&mut self) -> Result<&mut R>
Extract a mutable reference to the right value.
Errors
let mut right: Either<&str, &str> = Either::new_right("righty");
assert_eq!(right.right_ref()?, &"righty");
*(right.right_mut()?) = "right handed";
assert_eq!(right.right_ref()?, &"right handed");
sourcepub fn flip(self) -> Result<Either<R, L>>
pub fn flip(self) -> Result<Either<R, L>>
Convert Either<L, R>
to Either<R, L>
Errors
let left: Either<&str, &str> = Either::new_left("lefty");
let right = left.flip()?;
assert!(right.is_right());
assert_eq!(right.right_ref()?, &"lefty");
sourcepub fn map_left<F, FL>(self, f: F) -> Result<Either<FL, R>>where
F: FnOnce(L) -> FL,
pub fn map_left<F, FL>(self, f: F) -> Result<Either<FL, R>>where
F: FnOnce(L) -> FL,
Apply the function f
on the Left
value, returning the result
in a Left
. If this is applied to a Right
, the Right
is
returned.
Errors
let left: Either<u8, u8> = Either::new_left(10);
let mapped_left = left.map_left(|x| x * 10)?;
assert!(mapped_left.is_left());
assert_eq!(mapped_left.left_ref()?, &100);
sourcepub fn map_right<F, FR>(self, f: F) -> Result<Either<L, FR>>where
F: FnOnce(R) -> FR,
pub fn map_right<F, FR>(self, f: F) -> Result<Either<L, FR>>where
F: FnOnce(R) -> FR,
Apply the function f
on the Right
value, returning the result
in a Right
. If this is applied to a Left
, the Left
is
returned.
Errors
let right: Either<u8, u8> = Either::new_right(10);
let mapped_right = right.map_right(|x| x * 10)?;
assert!(mapped_right.is_right());
assert_eq!(mapped_right.right_ref()?, &100);
sourcepub fn map_left_or_right<FL, FR, RL, RR>(
self,
fl: FL,
fr: FR
) -> Result<Either<RL, RR>>where
FL: FnOnce(L) -> RL,
FR: FnOnce(R) -> RR,
pub fn map_left_or_right<FL, FR, RL, RR>(
self,
fl: FL,
fr: FR
) -> Result<Either<RL, RR>>where
FL: FnOnce(L) -> RL,
FR: FnOnce(R) -> RR,
If the variant is a Left
, apply the function fl
on the Left
value,
returning the result Left(fl(l))
. If the variant is a Right
value,
apply the function fr
on the Right
value, returning the result
Right(fr(r))
. If the varian is invalid, return an error.
Errors
let left: Either<u8, u8> = Either::new_left(10);
let mapped = left.map_left_or_right(|x| x * 10, |y| y * 5)?;
assert!(mapped.is_left());
assert_eq!(mapped.left_ref()?, &100);
let flipped = left.flip()?;
let mapped = flipped.map_left_or_right(|x| x * 10, |y| y * 5)?;
assert!(mapped.is_right());
assert_eq!(mapped.right_ref()?, &50);
sourcepub fn and_then_left<F, S>(self, f: F) -> Result<Either<S, R>>where
F: FnOnce(L) -> Either<S, R>,
pub fn and_then_left<F, S>(self, f: F) -> Result<Either<S, R>>where
F: FnOnce(L) -> Either<S, R>,
Apply the function f
on the value l
in the Left
variant if it
is present and return Left(f(l))
. Otherwise, returns the Right
variant. If the Either
is invalid, this function will return an
Error
result.
Errors
let left: Either<u16, u16> = Either::new_left(10);
let and_then_left: Either<u16, _> = left
.and_then_left(|x| Either::new_left(x * 10))?
.and_then_left(|x: u16| Either::new_left(x * 10))?;
assert!(and_then_left.is_left());
assert_eq!(and_then_left.left_ref()?, &1000);
let right: Either<u16, u16> = Either::new_right(5);
let not_a_left: Either<_, u16> = right
.and_then_left(|x| Either::new_left(x * 10))?
.and_then_left(|x: u16| Either::new_left(x * 10))?;
assert!(not_a_left.is_right());
assert_eq!(not_a_left.right_ref()?, &5);
sourcepub fn and_then_right<F, S>(self, f: F) -> Result<Either<L, S>>where
F: FnOnce(R) -> Either<L, S>,
pub fn and_then_right<F, S>(self, f: F) -> Result<Either<L, S>>where
F: FnOnce(R) -> Either<L, S>,
Apply the function f
on the value r
in the Right
variant if it
is present and return Right(f(r))
. Otherwise, returns the Left
variant. If the Either
is invalid, this function will return an
Error
result.
Errors
let right: Either<u16, u16> = Either::new_right(10);
let and_then_right: Either<u16, u16> = right
.and_then_right(|x| Either::new_right(x * 10))?
.and_then_right(|x: u16| Either::new_right(x * 10))?;
assert!(and_then_right.is_right());
assert_eq!(and_then_right.right_ref()?, &1000);
sourcepub fn into_iter(self) -> Result<Either<L::IntoIter, R::IntoIter>>where
L: IntoIterator,
R: IntoIterator<Item = L::Item>,
pub fn into_iter(self) -> Result<Either<L::IntoIter, R::IntoIter>>where
L: IntoIterator,
R: IntoIterator<Item = L::Item>,
Convert the inners to iters
Errors
Trait Implementations§
source§impl<L, R> BufRead for Either<L, R>where
L: BufRead,
R: BufRead,
impl<L, R> BufRead for Either<L, R>where
L: BufRead,
R: BufRead,
source§fn fill_buf(&mut self) -> Result<&[u8]>
fn fill_buf(&mut self) -> Result<&[u8]>
source§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
amt
bytes have been consumed from the buffer,
so they should no longer be returned in calls to read
. Read moresource§fn has_data_left(&mut self) -> Result<bool, Error>
fn has_data_left(&mut self) -> Result<bool, Error>
buf_read_has_data_left
)Read
has any data left to be read. Read more1.0.0 · source§fn read_until(
&mut self,
byte: u8,
buf: &mut Vec<u8, Global>
) -> Result<usize, Error>
fn read_until(
&mut self,
byte: u8,
buf: &mut Vec<u8, Global>
) -> Result<usize, Error>
1.0.0 · source§fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
0xA
byte) is reached, and append
them to the provided buffer. You do not need to clear the buffer before
appending. Read moresource§impl<'de, L, R> Deserialize<'de> for Either<L, R>where
L: Deserialize<'de>,
R: Deserialize<'de>,
impl<'de, L, R> Deserialize<'de> for Either<L, R>where
L: Deserialize<'de>,
R: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<L, R> DoubleEndedIterator for Either<L, R>where
L: DoubleEndedIterator,
R: DoubleEndedIterator<Item = L::Item>,
impl<L, R> DoubleEndedIterator for Either<L, R>where
L: DoubleEndedIterator,
R: DoubleEndedIterator<Item = L::Item>,
source§fn next_back(&mut self) -> Option<Self::Item>
fn next_back(&mut self) -> Option<Self::Item>
source§fn advance_back_by(&mut self, n: usize) -> Result<(), usize>
fn advance_back_by(&mut self, n: usize) -> Result<(), usize>
iter_advance_by
)n
elements. Read more1.37.0 · source§fn nth_back(&mut self, n: usize) -> Option<Self::Item>
fn nth_back(&mut self, n: usize) -> Option<Self::Item>
n
th element from the end of the iterator. Read more1.27.0 · source§fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
Iterator::try_fold()
: it takes
elements starting from the back of the iterator. Read moresource§impl<L, R> Error for Either<L, R>where
L: Error,
R: Error,
impl<L, R> Error for Either<L, R>where
L: Error,
R: Error,
source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl<L, R, A> Extend<A> for Either<L, R>where
L: Extend<A>,
R: Extend<A>,
impl<L, R, A> Extend<A> for Either<L, R>where
L: Extend<A>,
R: Extend<A>,
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = A>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = A>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<L, R> Iterator for Either<L, R>where
L: Iterator,
R: Iterator<Item = L::Item>,
impl<L, R> Iterator for Either<L, R>where
L: Iterator,
R: Iterator<Item = L::Item>,
source§fn next(&mut self) -> Option<Self::Item>
fn next(&mut self) -> Option<Self::Item>
source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
source§fn fold<Acc, G>(self, init: Acc, f: G) -> Accwhere
G: FnMut(Acc, Self::Item) -> Acc,
fn fold<Acc, G>(self, init: Acc, f: G) -> Accwhere
G: FnMut(Acc, Self::Item) -> Acc,
source§fn count(self) -> usize
fn count(self) -> usize
source§fn last(self) -> Option<Self::Item>
fn last(self) -> Option<Self::Item>
source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read moresource§fn all<F>(&mut self, f: F) -> boolwhere
F: FnMut(Self::Item) -> bool,
fn all<F>(&mut self, f: F) -> boolwhere
F: FnMut(Self::Item) -> bool,
source§fn next_chunk<const N: usize>(
&mut self
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
)N
values. Read moresource§fn advance_by(&mut self, n: usize) -> Result<(), usize>
fn advance_by(&mut self, n: usize) -> Result<(), usize>
iter_advance_by
)n
elements. Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator<Item = Self::Item>,
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator<Item = Self::Item>,
1.0.0 · source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
source§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where
Self: Sized,
G: FnMut() -> Self::Item,
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where
Self: Sized,
G: FnMut() -> Self::Item,
iter_intersperse
)separator
between adjacent items of the original iterator. Read more1.0.0 · source§fn map<B, F>(self, f: F) -> Map<Self, F>where
Self: Sized,
F: FnMut(Self::Item) -> B,
fn map<B, F>(self, f: F) -> Map<Self, F>where
Self: Sized,
F: FnMut(Self::Item) -> B,
1.21.0 · source§fn for_each<F>(self, f: F)where
Self: Sized,
F: FnMut(Self::Item),
fn for_each<F>(self, f: F)where
Self: Sized,
F: FnMut(Self::Item),
1.0.0 · source§fn filter<P>(self, predicate: P) -> Filter<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn filter<P>(self, predicate: P) -> Filter<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
1.0.0 · source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
1.0.0 · source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
1.0.0 · source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where
Self: Sized,
P: FnMut(Self::Item) -> Option<B>,
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where
Self: Sized,
P: FnMut(Self::Item) -> Option<B>,
1.0.0 · source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 · source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · source§fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Option<B>,
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Option<B>,
1.0.0 · source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where
Self: Sized,
U: IntoIterator,
F: FnMut(Self::Item) -> U,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where
Self: Sized,
U: IntoIterator,
F: FnMut(Self::Item) -> U,
1.0.0 · source§fn inspect<F>(self, f: F) -> Inspect<Self, F>where
Self: Sized,
F: FnMut(&Self::Item),
fn inspect<F>(self, f: F) -> Inspect<Self, F>where
Self: Sized,
F: FnMut(&Self::Item),
1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
1.0.0 · source§fn collect<B>(self) -> Bwhere
B: FromIterator<Self::Item>,
Self: Sized,
fn collect<B>(self) -> Bwhere
B: FromIterator<Self::Item>,
Self: Sized,
source§fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere
E: Extend<Self::Item>,
Self: Sized,
fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere
E: Extend<Self::Item>,
Self: Sized,
iter_collect_into
)1.0.0 · source§fn partition<B, F>(self, f: F) -> (B, B)where
Self: Sized,
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool,
fn partition<B, F>(self, f: F) -> (B, B)where
Self: Sized,
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool,
source§fn is_partitioned<P>(self, predicate: P) -> boolwhere
Self: Sized,
P: FnMut(Self::Item) -> bool,
fn is_partitioned<P>(self, predicate: P) -> boolwhere
Self: Sized,
P: FnMut(Self::Item) -> bool,
iter_is_partitioned
)true
precede all those that return false
. Read more1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> Rwhere
Self: Sized,
F: FnMut(Self::Item) -> R,
R: Try<Output = ()>,
fn try_for_each<F, R>(&mut self, f: F) -> Rwhere
Self: Sized,
F: FnMut(Self::Item) -> R,
R: Try<Output = ()>,
1.51.0 · source§fn reduce<F>(self, f: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> Self::Item,
fn reduce<F>(self, f: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> Self::Item,
source§fn try_reduce<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> R,
R: Try<Output = Self::Item>,
<R as Try>::Residual: Residual<Option<Self::Item>>,
fn try_reduce<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> R,
R: Try<Output = Self::Item>,
<R as Try>::Residual: Residual<Option<Self::Item>>,
iterator_try_reduce
)1.0.0 · source§fn any<F>(&mut self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> bool,
fn any<F>(&mut self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> bool,
1.0.0 · source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
1.30.0 · source§fn find_map<B, F>(&mut self, f: F) -> Option<B>where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn find_map<B, F>(&mut self, f: F) -> Option<B>where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
source§fn try_find<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere
Self: Sized,
F: FnMut(&Self::Item) -> R,
R: Try<Output = bool>,
<R as Try>::Residual: Residual<Option<Self::Item>>,
fn try_find<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere
Self: Sized,
F: FnMut(&Self::Item) -> R,
R: Try<Output = bool>,
<R as Try>::Residual: Residual<Option<Self::Item>>,
try_find
)1.0.0 · source§fn position<P>(&mut self, predicate: P) -> Option<usize>where
Self: Sized,
P: FnMut(Self::Item) -> bool,
fn position<P>(&mut self, predicate: P) -> Option<usize>where
Self: Sized,
P: FnMut(Self::Item) -> bool,
1.6.0 · source§fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where
B: Ord,
Self: Sized,
F: FnMut(&Self::Item) -> B,
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where
B: Ord,
Self: Sized,
F: FnMut(&Self::Item) -> B,
1.15.0 · source§fn max_by<F>(self, compare: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn max_by<F>(self, compare: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
1.6.0 · source§fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where
B: Ord,
Self: Sized,
F: FnMut(&Self::Item) -> B,
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where
B: Ord,
Self: Sized,
F: FnMut(&Self::Item) -> B,
1.15.0 · source§fn min_by<F>(self, compare: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn min_by<F>(self, compare: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
1.0.0 · source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Sized + Iterator<Item = (A, B)>,
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Sized + Iterator<Item = (A, B)>,
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self>where
T: 'a + Copy,
Self: Sized + Iterator<Item = &'a T>,
fn copied<'a, T>(self) -> Copied<Self>where
T: 'a + Copy,
Self: Sized + Iterator<Item = &'a T>,
1.0.0 · source§fn cloned<'a, T>(self) -> Cloned<Self>where
T: 'a + Clone,
Self: Sized + Iterator<Item = &'a T>,
fn cloned<'a, T>(self) -> Cloned<Self>where
T: 'a + Clone,
Self: Sized + Iterator<Item = &'a T>,
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
)N
elements of the iterator at a time. Read more1.11.0 · source§fn sum<S>(self) -> Swhere
Self: Sized,
S: Sum<Self::Item>,
fn sum<S>(self) -> Swhere
Self: Sized,
S: Sum<Self::Item>,
1.11.0 · source§fn product<P>(self) -> Pwhere
Self: Sized,
P: Product<Self::Item>,
fn product<P>(self) -> Pwhere
Self: Sized,
P: Product<Self::Item>,
source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 · source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>where
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
fn partial_cmp<I>(self, other: I) -> Option<Ordering>where
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
source§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 · source§fn eq<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialEq<<I as IntoIterator>::Item>,
Self: Sized,
fn eq<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialEq<<I as IntoIterator>::Item>,
Self: Sized,
source§fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
)1.5.0 · source§fn ne<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialEq<<I as IntoIterator>::Item>,
Self: Sized,
fn ne<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialEq<<I as IntoIterator>::Item>,
Self: Sized,
1.5.0 · source§fn lt<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
fn lt<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
Iterator
are lexicographically
less than those of another. Read more1.5.0 · source§fn le<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
fn le<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
Iterator
are lexicographically
less or equal to those of another. Read more1.5.0 · source§fn gt<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
fn gt<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
Iterator
are lexicographically
greater than those of another. Read more1.5.0 · source§fn ge<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
fn ge<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<<I as IntoIterator>::Item>,
Self: Sized,
Iterator
are lexicographically
greater than or equal to those of another. Read moresource§fn is_sorted_by<F>(self, compare: F) -> boolwhere
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
fn is_sorted_by<F>(self, compare: F) -> boolwhere
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
is_sorted
)source§fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> K,
K: PartialOrd<K>,
fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> K,
K: PartialOrd<K>,
is_sorted
)source§impl<L: Ord, R: Ord> Ord for Either<L, R>
impl<L: Ord, R: Ord> Ord for Either<L, R>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<L: PartialEq, R: PartialEq> PartialEq<Either<L, R>> for Either<L, R>
impl<L: PartialEq, R: PartialEq> PartialEq<Either<L, R>> for Either<L, R>
source§impl<L: PartialOrd, R: PartialOrd> PartialOrd<Either<L, R>> for Either<L, R>
impl<L: PartialOrd, R: PartialOrd> PartialOrd<Either<L, R>> for Either<L, R>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<L, R> Read for Either<L, R>where
L: Read,
R: Read,
impl<L, R> Read for Either<L, R>where
L: Read,
R: Read,
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
buf
. Read more1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read moresource§impl<L, R> Write for Either<L, R>where
L: Write,
R: Write,
impl<L, R> Write for Either<L, R>where
L: Write,
R: Write,
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)