Macro itertools::izip [] [src]

macro_rules! izip {
    ($I:expr) => { ... };
    ($($I:expr),*) => { ... };
}

Create an iterator running multiple iterators in lockstep.

The izip! iterator yields elements until any subiterator returns None.

Iterator element type is like (A, B, ..., E) if formed from iterators (I, J, ..., M) implementing I: Iterator<A>, J: Iterator<B>, ..., M: Iterator<E>

#[macro_use] extern crate itertools;

// Iterate over three sequences side-by-side
let mut xs = [0, 0, 0];
let ys = [69, 107, 101];

for (i, a, b) in izip!(0..100, &mut xs, &ys) {
   *a = i ^ *b;
}

assert_eq!(xs, [69, 106, 103]);

Note: To enable the macros in this crate, use the #[macro_use] attribute when importing the crate.

Be careful when using this code, it's not being tested!
#[macro_use] extern crate itertools;