Trait mz_ore::iter::IteratorExt

source ·
pub trait IteratorExt
where Self: Iterator + Sized,
{ // Provided methods fn chain_one(self, item: Self::Item) -> Chain<Self, Once<Self::Item>> { ... } fn all_equal(self) -> bool where Self::Item: PartialEq { ... } fn exact_size(self, len: usize) -> ExactSize<Self> { ... } }
Expand description

Extension methods for iterators.

Provided Methods§

source

fn chain_one(self, item: Self::Item) -> Chain<Self, Once<Self::Item>>

Chains a single item onto the end of this iterator.

Equivalent to self.chain(iter::once(item)).

source

fn all_equal(self) -> bool
where Self::Item: PartialEq,

Reports whether all the elements of the iterator are the same.

This condition is trivially true for iterators with zero or one elements.

source

fn exact_size(self, len: usize) -> ExactSize<Self>

Converts the the iterator into an ExactSizeIterator reporting the given size.

The caller is responsible for providing the correct size of the iterator! Providing an incorrect size value will lead to panics and/or incorrect responses to size queries.

§Panics

Panics if the given length is not consistent with this iterator’s size_hint.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<I> IteratorExt for I
where I: Iterator,