Function itertools::zip [] [src]

Important traits for Zip<A, B>
pub fn zip<I, J>(i: I, j: J) -> Zip<I::IntoIter, J::IntoIter> where
    I: IntoIterator,
    J: IntoIterator

Iterate i and j in lock step.

IntoIterator enabled version of i.zip(j).

use itertools::zip;

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