PopulatedIterator

Trait PopulatedIterator 

Source
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§

Source

fn next(self) -> (Self::Item, Self::IntoIter)

Advances the iterator and returns the first value and a new iterator to the remaining values.

Provided Methods§

Source

fn collect<C: FromPopulatedIterator<Self::Item>>(self) -> C
where Self: Sized,

Collects the iterator into a collection. Supports constructing collections that require a populated iterator.

Source

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.

Source

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates an iterator giving the current element count along with the element. Preserves the populated property.

Source

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.

Source

fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: IntoPopulatedIterator,

Flattens a populated iterator of populated iteratorables into a single iterator. Preserves the populated property.

Source

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.

Source

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.

Source

fn max(self) -> Self::Item
where Self::Item: Ord, Self: Sized,

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.

Source

fn min(self) -> Self::Item
where Self::Item: Ord, Self: Sized,

Returns the minimum element of the iterator.

Source

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.

Source

fn reduce( self, f: impl FnMut(Self::Item, Self::Item) -> Self::Item, ) -> Self::Item
where 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.

Source

fn max_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Item
where 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.

Source

fn max_by( self, compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering, ) -> Self::Item
where 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.

Source

fn min_by_key<K: Ord>(self, f: impl FnMut(&Self::Item) -> K) -> Self::Item
where 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.

Source

fn min_by( self, compare: impl FnMut(&Self::Item, &Self::Item) -> Ordering, ) -> Self::Item
where 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.

Source

fn eq<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialEq<I::Item>, Self: Sized,

Source

fn last(self) -> Self::Item
where Self: Sized,

Source

fn rev(self) -> Rev<Self>
where Self: Sized,

Source

fn nth(self, n: usize) -> (Option<Self::Item>, Self::IntoIter)
where Self: Sized,

Source

fn count(self) -> NonZeroUsize
where Self: Sized,

Implementors§

Source§

impl<'a> PopulatedIterator for Chars<'a>

Source§

impl<'a, K, V> PopulatedIterator for populated::btree_map::PopulatedIter<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::btree_map::PopulatedIterMut<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::btree_map::PopulatedKeys<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::btree_map::PopulatedValues<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::btree_map::PopulatedValuesMut<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::hash_map::PopulatedIter<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::hash_map::PopulatedIterMut<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::hash_map::PopulatedKeys<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::hash_map::PopulatedValues<'a, K, V>

Source§

impl<'a, K, V> PopulatedIterator for populated::hash_map::PopulatedValuesMut<'a, K, V>

Source§

impl<'a, T> PopulatedIterator for populated::binary_heap::PopulatedIter<'a, T>

Source§

impl<'a, T> PopulatedIterator for populated::btree_set::PopulatedIter<'a, T>

Source§

impl<'a, T> PopulatedIterator for populated::hash_set::PopulatedIter<'a, T>

Source§

impl<'a, T> PopulatedIterator for populated::slice::PopulatedIter<'a, T>

Source§

impl<'a, T> PopulatedIterator for populated::slice::PopulatedIterMut<'a, T>

Source§

impl<'a, T> PopulatedIterator for populated::vec_deque::PopulatedIter<'a, T>

Source§

impl<'a, T> PopulatedIterator for populated::vec_deque::PopulatedIterMut<'a, T>

Source§

impl<I: PopulatedDoubleEndedIterator> PopulatedIterator for Rev<I>

Source§

impl<I: PopulatedIterator> PopulatedIterator for Enumerate<I>

Source§

impl<I: PopulatedIterator> PopulatedIterator for Flatten<I>

Source§

impl<I: PopulatedIterator> PopulatedIterator for Take<I>

Source§

impl<I: PopulatedIterator, F: FnMut(I::Item) -> O, O> PopulatedIterator for Map<I, F>

Source§

impl<I: PopulatedIterator, J: PopulatedIterator> PopulatedIterator for Zip<I, J>

Source§

impl<K, V> PopulatedIterator for populated::btree_map::IntoPopulatedIter<K, V>

Source§

impl<K, V> PopulatedIterator for populated::btree_map::PopulatedIntoKeys<K, V>

Source§

impl<K, V> PopulatedIterator for populated::btree_map::PopulatedIntoValues<K, V>

Source§

impl<K, V> PopulatedIterator for populated::hash_map::PopulatedIntoIter<K, V>

Source§

impl<K, V> PopulatedIterator for populated::hash_map::PopulatedIntoKeys<K, V>

Source§

impl<K, V> PopulatedIterator for populated::hash_map::PopulatedIntoValues<K, V>

Source§

impl<P: PopulatedIterator, I: Iterator<Item = P::Item>> PopulatedIterator for Chain<P, I>

Source§

impl<T> PopulatedIterator for populated::binary_heap::IntoPopulatedIter<T>

Source§

impl<T> PopulatedIterator for populated::btree_set::IntoPopulatedIter<T>

Source§

impl<T> PopulatedIterator for populated::hash_set::IntoPopulatedIter<T>

Source§

impl<T> PopulatedIterator for populated::vec::PopulatedIntoIter<T>

Source§

impl<T> PopulatedIterator for populated::vec_deque::PopulatedIntoIter<T>