Function itertools::zip

source ·
pub fn zip<I, J>(i: I, j: J) -> Zip<I::IntoIter, J::IntoIter>
👎Deprecated since 0.10.4: Use std::iter::zip instead
Expand description

Converts the arguments to iterators and zips them.

IntoIterator enabled version of Iterator::zip.

Example

use itertools::zip;

let mut result: Vec<(i32, char)> = Vec::new();

for (a, b) in zip(&[1, 2, 3, 4, 5], &['a', 'b', 'c']) {
    result.push((*a, *b));
}
assert_eq!(result, vec![(1, 'a'),(2, 'b'),(3, 'c')]);