pub trait PopulatedIterator: IntoIterator {
Show 21 methods
// Required method
fn next(self) -> (Self::Item, Self::IntoIter);
// Provided methods
fn collect<C: FromPopulatedIterator<Self::Item>>(self) -> C
where Self: Sized { ... }
fn map<B, F: FnMut(Self::Item) -> B>(self, f: F) -> Map<Self, F>
where Self: Sized { ... }
fn enumerate(self) -> Enumerate<Self>
where Self: Sized { ... }
fn zip<J>(self, other: J) -> Zip<Self, J>
where Self: Sized { ... }
fn flatten(self) -> Flatten<Self>
where Self: Sized,
Self::Item: IntoPopulatedIterator { ... }
fn take(self, n: NonZeroUsize) -> Take<Self>
where Self: Sized { ... }
fn flat_map<B: IntoPopulatedIterator, F: FnMut(Self::Item) -> B>(
self,
f: F,
) -> Flatten<Map<Self, F>>
where Self: Sized { ... }
fn max(self) -> Self::Item
where Self::Item: Ord,
Self: Sized { ... }
fn min(self) -> Self::Item
where Self::Item: Ord,
Self: Sized { ... }
fn chain<I: IntoIterator<Item = Self::Item>>(
self,
other: I,
) -> Chain<Self, I::IntoIter>
where Self: Sized { ... }
fn reduce(
self,
f: impl FnMut(Self::Item, Self::Item) -> Self::Item,
) -> Self::Item
where Self: Sized { ... }
fn max_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Item
where Self: Sized { ... }
fn max_by(
self,
compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering,
) -> Self::Item
where Self: Sized { ... }
fn min_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Item
where Self: Sized { ... }
fn min_by(
self,
compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering,
) -> Self::Item
where Self: Sized { ... }
fn eq<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialEq<I::Item>,
Self: Sized { ... }
fn last(self) -> Self::Item
where Self: Sized { ... }
fn rev(self) -> Rev<Self>
where Self: Sized { ... }
fn nth(self, n: usize) -> (Option<Self::Item>, Self::IntoIter)
where Self: Sized { ... }
fn count(self) -> NonZeroUsize
where Self: Sized { ... }
}Expand description
An iterator that guaratees that there is at least one element.
Required Methods§
Provided Methods§
Sourcefn collect<C: FromPopulatedIterator<Self::Item>>(self) -> Cwhere
Self: Sized,
fn collect<C: FromPopulatedIterator<Self::Item>>(self) -> Cwhere
Self: Sized,
Collects the iterator into a collection. Supports constructing collections that require a populated iterator.
Sourcefn map<B, F: FnMut(Self::Item) -> B>(self, f: F) -> Map<Self, F>where
Self: Sized,
fn map<B, F: FnMut(Self::Item) -> B>(self, f: F) -> Map<Self, F>where
Self: Sized,
Takes a closure and creates an iterator which calls that closure on each element. Preserves the populated property.
Sourcefn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
Creates an iterator giving the current element count along with the element. Preserves the populated property.
Sourcefn zip<J>(self, other: J) -> Zip<Self, J>where
Self: Sized,
fn zip<J>(self, other: J) -> Zip<Self, J>where
Self: Sized,
Zips this iterator with another iterator to yield a new iterator of pairs. Preserves the populated property.
Sourcefn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Flattens a populated iterator of populated iteratorables into a single iterator. Preserves the populated property.
Sourcefn take(self, n: NonZeroUsize) -> Take<Self>where
Self: Sized,
fn take(self, n: NonZeroUsize) -> Take<Self>where
Self: Sized,
Creates an iterator taking at most n elements from this iterator, where n is non-zero.
Preserves the populated property.
Sourcefn flat_map<B: IntoPopulatedIterator, F: FnMut(Self::Item) -> B>(
self,
f: F,
) -> Flatten<Map<Self, F>>where
Self: Sized,
fn flat_map<B: IntoPopulatedIterator, F: FnMut(Self::Item) -> B>(
self,
f: F,
) -> Flatten<Map<Self, F>>where
Self: Sized,
Creates an iterator that works like map, but flattens nested populated structure. Preserves the
populated property.
Sourcefn max(self) -> Self::Item
fn max(self) -> Self::Item
Returns the maximum element of the iterator. Note that unlike the standard library, this
method directly returns the maximum element instead of an Option. This is because this
method is only available on populated iterators.
Sourcefn chain<I: IntoIterator<Item = Self::Item>>(
self,
other: I,
) -> Chain<Self, I::IntoIter>where
Self: Sized,
fn chain<I: IntoIterator<Item = Self::Item>>(
self,
other: I,
) -> Chain<Self, I::IntoIter>where
Self: Sized,
Takes self populator and another iteratorable and creates a new iterator over both in sequence. Preserves the populated property.
Sourcefn reduce(
self,
f: impl FnMut(Self::Item, Self::Item) -> Self::Item,
) -> Self::Itemwhere
Self: Sized,
fn reduce(
self,
f: impl FnMut(Self::Item, Self::Item) -> Self::Item,
) -> Self::Itemwhere
Self: Sized,
Reduces the iterator to a single value using a closure. Note that unlike the standard library,
this method directly returns the reduced value instead of an Option. This is because this
method is only available on populated iterators.
Sourcefn max_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Itemwhere
Self: Sized,
fn max_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Itemwhere
Self: Sized,
Returns the element that gives the maximum value from the specified function. Note that unlike the standard library,
this method directly returns the maximum element instead of an Option. This is because this
method is only available on populated iterators.
Sourcefn max_by(
self,
compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering,
) -> Self::Itemwhere
Self: Sized,
fn max_by(
self,
compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering,
) -> Self::Itemwhere
Self: Sized,
Returns the element that gives the maximum value with respect to the specified comparison function. Note that unlike the standard library,
this method directly returns the maximum element instead of an Option. This is because this
method is only available on populated iterators.
Sourcefn min_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Itemwhere
Self: Sized,
fn min_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Itemwhere
Self: Sized,
Returns the element that gives the minimum value from the specified function. Note that unlike the standard library,
this method directly returns the minimum element instead of an Option. This is because this
method is only available on populated iterators.
Sourcefn min_by(
self,
compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering,
) -> Self::Itemwhere
Self: Sized,
fn min_by(
self,
compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering,
) -> Self::Itemwhere
Self: Sized,
Returns the element that gives the minimum value with respect to the specified comparison function. Note that unlike the standard library,
this method directly returns the minimum element instead of an Option. This is because this
method is only available on populated iterators.