Function std::iter::zip
pub fn zip<A, B>( a: A, b: B) -> Zip<<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter>ⓘNotable traits for Zip<A, B>impl<A, B> Iterator for Zip<A, B> where B: Iterator, A: Iterator, type Item = (<A as Iterator>::Item, <B as Iterator>::Item); where B: IntoIterator, A: IntoIterator,
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); }
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/iter/fn.zip.html