Struct nonempty_collections::iter::Chain
source · pub struct Chain<A, B> { /* private fields */ }
Expand description
A non-empty iterator that links two iterators together, in a chain.
Trait Implementations§
source§impl<A, B> IntoIterator for Chain<A, B>
impl<A, B> IntoIterator for Chain<A, B>
§type Item = <A as IntoIterator>::Item
type Item = <A as IntoIterator>::Item
The type of the elements being iterated over.
§type IntoIter = Chain<<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter>
type IntoIter = Chain<<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter>
Which kind of iterator are we turning this into?
source§impl<A, B> NonEmptyIterator for Chain<A, B>
impl<A, B> NonEmptyIterator for Chain<A, B>
§type Item = <A as NonEmptyIterator>::Item
type Item = <A as NonEmptyIterator>::Item
The value produced by this iterator.
§type IntoIter = Chain<<<A as NonEmptyIterator>::IntoIter as IntoIterator>::IntoIter, B>
type IntoIter = Chain<<<A as NonEmptyIterator>::IntoIter as IntoIterator>::IntoIter, B>
Each
NonEmptyIterator
knows about a possibly-empty variant of itself,
likely from std
. Critically, they share an Item
.source§fn first(self) -> (Self::Item, Self::IntoIter)
fn first(self) -> (Self::Item, Self::IntoIter)
A
NonEmptyIterator
can, by consuming itself, reliably produce its
first element, alongside its possibly-empty variant.source§fn next(&mut self) -> Option<Self::Item>
fn next(&mut self) -> Option<Self::Item>
Advances the iterator and returns the next value. Read more
source§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more
source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more
source§fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter>
Takes two iterators and creates a new non-empty iterator over both in sequence. Read more
source§fn cloned<'a, T>(self) -> Cloned<Self>
fn cloned<'a, T>(self) -> Cloned<Self>
Creates a non-empty iterator which clones all of its elements. Read more
source§fn collect<B>(self) -> B
fn collect<B>(self) -> B
Transforms an iterator into a collection, or some other concrete value. Read more
source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Creates a non-empty iterator which copies all of its elements. Read more
source§fn count(self) -> NonZeroUsizewhere
Self: Sized,
fn count(self) -> NonZeroUsizewhere
Self: Sized,
Consumes the non-empty iterator, counting the number of iterations and
returning it. Read more
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
Creates a non-empty iterator which gives the current iteration count as
well as the next value. Read more
source§fn flat_map<U, V, F>(self, f: F) -> FlatMap<Self, V, F>where
Self: Sized,
F: FnMut(Self::Item) -> U,
U: IntoNonEmptyIterator<IntoIter = V, Item = V::Item>,
V: NonEmptyIterator,
fn flat_map<U, V, F>(self, f: F) -> FlatMap<Self, V, F>where
Self: Sized,
F: FnMut(Self::Item) -> U,
U: IntoNonEmptyIterator<IntoIter = V, Item = V::Item>,
V: NonEmptyIterator,
Creates an iterator that works like
map
, but flattens nested,
non-empty structure. Read moresource§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,
returning the final result. Read more
source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates a non-empty iterator which calls that
closure on each element. Read more
source§fn max_by<F>(self, compare: F) -> Self::Item
fn max_by<F>(self, compare: F) -> Self::Item
Returns the element that gives the maximum value with respect to the
given comparison function. Read more
source§fn max_by_key<B, F>(self, key: F) -> Self::Item
fn max_by_key<B, F>(self, key: F) -> Self::Item
Returns the element that gives the maximum value from the
specified function. Read more
source§fn min_by<F>(self, compare: F) -> Self::Item
fn min_by<F>(self, compare: F) -> Self::Item
Returns the element that gives the minimum value with respect to the
given comparison function. Read more
source§fn min_by_key<B, F>(self, key: F) -> Self::Item
fn min_by_key<B, F>(self, key: F) -> Self::Item
Returns the element that gives the minimum value from the
specified function. Read more
source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the
n
th element of the iterator. Read moresource§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Iterates over the first
n
elements, or fewer if the underlying iterator ends sooner. Read moreAuto Trait Implementations§
impl<A, B> Freeze for Chain<A, B>
impl<A, B> RefUnwindSafe for Chain<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Chain<A, B>
impl<A, B> Sync for Chain<A, B>
impl<A, B> Unpin for Chain<A, B>
impl<A, B> UnwindSafe for Chain<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
source§impl<T> IntoIteratorExt for Twhere
T: IntoIterator,
impl<T> IntoIteratorExt for Twhere
T: IntoIterator,
source§fn try_into_nonempty_iter(self) -> Option<<T as IntoIteratorExt>::IntoIter>
fn try_into_nonempty_iter(self) -> Option<<T as IntoIteratorExt>::IntoIter>
Tries to convert self
into NonEmptyIterator
. Calls self.next()
once. If self
doesn’t return Some
upon the first call to next()
,
returns None
.
§type Item = <T as IntoIterator>::Item
type Item = <T as IntoIterator>::Item
The type of the elements being iterated over.
§type IntoIter = Chain<Once<<T as IntoIteratorExt>::Item>, <T as IntoIterator>::IntoIter>
type IntoIter = Chain<Once<<T as IntoIteratorExt>::Item>, <T as IntoIterator>::IntoIter>
Which kind of
NonEmptyIterator
are we turning this into?source§impl<I> IntoNonEmptyIterator for Iwhere
I: NonEmptyIterator,
impl<I> IntoNonEmptyIterator for Iwhere
I: NonEmptyIterator,
§type Item = <I as NonEmptyIterator>::Item
type Item = <I as NonEmptyIterator>::Item
The type of the elements being iterated over.
§type IntoIter = I
type IntoIter = I
Which kind of
NonEmptyIterator
are we turning this into?source§fn into_nonempty_iter(self) -> <I as IntoNonEmptyIterator>::IntoIter
fn into_nonempty_iter(self) -> <I as IntoNonEmptyIterator>::IntoIter
Creates a
NonEmptyIterator
from a value.