devela::_dep::itertools

Function zip_eq

pub fn zip_eq<I, J>(
    i: I,
    j: J,
) -> ZipEq<<I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter> 
Available on crate feature dep_itertools only.
Expand description

Zips two iterators but panics if they are not of the same length.

IntoIterator enabled version of Itertools::zip_eq.

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 */
}