Function core::iter::zip [−][src]
pub fn zip<A, B>(a: A, b: B) -> Zip<A::IntoIter, B::IntoIter>ⓘ where
A: IntoIterator,
B: IntoIterator,
Expand description
Converts the arguments to iterators and zips them.
See the documentation of Iterator::zip
for more.
Examples
#![feature(iter_zip)]
use std::iter::zip;
let xs = [1, 2, 3];
let ys = [4, 5, 6];
for (x, y) in zip(&xs, &ys) {
println!("x:{}, y:{}", x, y);
}
// Nested zips are also possible:
let zs = [7, 8, 9];
for ((x, y), z) in zip(zip(&xs, &ys), &zs) {
println!("x:{}, y:{}, z:{}", x, y, z);
}
Run