Function itertools::zip

source · []
pub fn zip<I, J>(i: I, j: J) -> Zip<I::IntoIter, J::IntoIter> where
    I: IntoIterator,
    J: IntoIterator
Expand description

Iterate i and j in lock step.

IntoIterator enabled version of Iterator::zip.

use itertools::zip;

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