#tuple #iterator #zip #convert

tuple_zip

Convert a tuple of iterators into an iterator of tuples

1 unstable release

0.1.0 Dec 22, 2022

#2950 in Rust patterns

MIT/Apache

6KB

tuple_zip

A crate for converting a tuple of iterators into an iterator of tuples

use tuple_zip::TupleZip;

let a = [1, 2, 3, 4];
let b = [5, 6, 7];
let c = ["x", "y", "z"];

let zipped = (a, b, c).tuple_zip();

let expected = [(1, 5, "x"), (2, 6, "y"), (3, 7, "z")];
assert!(zipped.eq(expected));

Licensed under Apache-2.0 or MIT, at your choice


lib.rs:

A crate for converting a tuple of iterators into an iterator of tuples

use tuple_zip::TupleZip;

let a = [1, 2, 3, 4];
let b = [5, 6, 7];
let c = ["x", "y", "z"];

let zipped = (a, b, c).tuple_zip();

let expected = [(1, 5, "x"), (2, 6, "y"), (3, 7, "z")];
assert!(zipped.eq(expected));

No runtime deps