pub fn enumerate<I>(iterable: I) -> Enumerate<I::IntoIter>where
    I: IntoIterator,
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 */
}