Function itertools::zip_eq[][src]

pub fn zip_eq<I, J>(i: I, j: J) -> ZipEq<I::IntoIter, J::IntoIter>
Notable traits for ZipEq<I, J>
impl<I, J> Iterator for ZipEq<I, J> where
    I: Iterator,
    J: Iterator
type Item = (I::Item, J::Item);
where
    I: IntoIterator,
    J: IntoIterator
Expand description

Iterate i and j in lock step.

Panics if the iterators are not of the same length.

IntoIterator enabled version of i.zip_eq(j).

use itertools::zip_eq;

let data = [1, 2, 3, 4, 5];
for (a, b) in zip_eq(&data[..data.len() - 1], &data[1..]) {
    /* loop body */
}