Struct std::iter::Enumerate
[−]
[src]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub struct Enumerate<I> { // some fields omitted }1.0.0
An iterator that yields the current count and the element during iteration.
This struct
is created by the enumerate()
method on Iterator
. See its
documentation for more.
Trait Implementations
impl<I> ExactSizeIterator for Enumerate<I> where I: ExactSizeIterator
impl<I> DoubleEndedIterator for Enumerate<I> where I: ExactSizeIterator + DoubleEndedIterator
impl<I> Iterator for Enumerate<I> where I: Iterator
type Item = (usize, I::Item)
fn next(&mut self) -> Option<(usize, I::Item)>
Overflow Behavior
The method does no guarding against overflows, so enumerating more than
usize::MAX
elements either produces the wrong result or panics. If
debug assertions are enabled, a panic is guaranteed.
Panics
Might panic if the index of the element overflows a usize
.