devela::_dep::itertools

Function enumerate

pub fn enumerate<I>(iterable: I) -> Enumerate<<I as IntoIterator>::IntoIter> 
where I: IntoIterator,
Available on crate feature dep_itertools only.
Expand description

Iterate iterable with a running index.

IntoIterator enabled version of Iterator::enumerate.

use itertools::enumerate;

for (i, elt) in enumerate(&[1, 2, 3]) {
    /* loop body */
}