pub trait Itertools: Iterator {
// Provided methods
fn looping_forever(self) -> LoopingForever<Self::Item> ⓘ
where Self: Sized + Iterator,
Self::Item: Clone { ... }
fn collect_exact(self, count: usize) -> Vec<Option<Self::Item>>
where Self: Sized + Iterator,
Self::Item: Clone { ... }
fn collect_exact_or(self, count: usize, def: Self::Item) -> Vec<Self::Item>
where Self: Sized + Iterator,
Self::Item: Clone { ... }
fn collect_exact_or_default(self, count: usize) -> Vec<Self::Item>
where Self: Sized + Iterator,
Self::Item: Clone + Default { ... }
fn collect_next_chunk(&mut self, count: usize) -> Vec<Self::Item> { ... }
fn joining(self, delim: Self::Item) -> Joining<Self, Self::Item>
where Self: Sized,
Self::Item: Clone { ... }
fn joining_multi(
self,
delim: &[Self::Item],
) -> MultiJoining<Self, Self::Item>
where Self: Sized,
Self::Item: Clone { ... }
}Expand description
Itertools adds helpful additional methods to Iterator
Provided Methods§
Sourcefn looping_forever(self) -> LoopingForever<Self::Item> ⓘ
fn looping_forever(self) -> LoopingForever<Self::Item> ⓘ
Returns an iterator that never ends, sequentially looping over all items in this iterator forever, unless there are no items in the iterator.
Sourcefn collect_exact(self, count: usize) -> Vec<Option<Self::Item>>
fn collect_exact(self, count: usize) -> Vec<Option<Self::Item>>
Collects a specific amount of items from the iterator. The underlying iterator may return more, or less items than the specified count. Any remaining uncollected items will be discarded. If count is greater than the length of the underlying iterator, then the remainder of the returned vector will be None.
Sourcefn collect_exact_or(self, count: usize, def: Self::Item) -> Vec<Self::Item>
fn collect_exact_or(self, count: usize, def: Self::Item) -> Vec<Self::Item>
Same behavior as Itertools::collect_exact, except rather than returning ‘None’ after the end, it
returns the specified value
Sourcefn collect_exact_or_default(self, count: usize) -> Vec<Self::Item>
fn collect_exact_or_default(self, count: usize) -> Vec<Self::Item>
Same behavior as Itertools::collect_exact, except rather than returning ‘None’ after the end, it
returns the default value
Sourcefn collect_next_chunk(&mut self, count: usize) -> Vec<Self::Item>
fn collect_next_chunk(&mut self, count: usize) -> Vec<Self::Item>
Collects and returns upto ‘count’ items from this iterator. If this iterator is exhausted, the returned vector is empty. Note, the returned vector may have up to the requested number of items if the iterator exhausts before filling the chunk.
Sourcefn joining(self, delim: Self::Item) -> Joining<Self, Self::Item>
fn joining(self, delim: Self::Item) -> Joining<Self, Self::Item>
Returns the elements in this iterator interspersed with the joining delimiter.
For example, if this iterator contains [A, B, C, D] and the delimiter is z, then the
final iteration sequence will be [A, z, B, z, C, z, D]
Sourcefn joining_multi(self, delim: &[Self::Item]) -> MultiJoining<Self, Self::Item>
fn joining_multi(self, delim: &[Self::Item]) -> MultiJoining<Self, Self::Item>
Returns the elements in this iterator interspersed with the elements in the joining delimeter.
For example, if this iterator contains [A, B, C, D] and the delimiters are [1, 2], then
the final iteration sequence will be [A, 1, 2, B, 1, 2, C, 1, 2, D]