1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/// Zip multiple iterators.
///
/// This is not unlike the `izip!` macro from `itertools`, but this has a simpler implementation,
/// and does not call `into_iter` on its arguments.
///
/// # Examples
///
/// Zipping multiple iterators can significantly reduce the boulerplate ".zip" calls and extra
/// parentheses.
///
/// ```rust
/// # fn main() {
/// use flatk::zip;
///
/// let av = vec![1,2,3,4];
/// let bv = vec![5,6,7,8];
/// let cv = vec![9,10,11,12];
///
/// for (a, b, c) in zip!(av.into_iter(), bv.into_iter(), cv.into_iter()) {
/// println!("({}, {}, {})", a, b, c);
/// }
/// # }
/// ```
///
/// This macro can be used in other contexts where iterators are useful. The trailing
/// comma is optional for convenience.
///
/// ```rust
/// # fn main() {
/// use flatk::zip;
///
/// let a_vec = vec![1,2,3,4];
/// let b_vec = vec![5,6,7,8];
/// let c_vec = vec![9,10,11,12];
///
/// let zipped: Vec<(usize, usize, usize)> = zip!(
/// a_vec.into_iter(),
/// b_vec.into_iter(),
/// c_vec.into_iter(), // with trailing comma
/// ).collect();
///
/// assert_eq!(zipped, vec![(1,5,9), (2,6,10), (3,7,11), (4,8,12)])
/// # }
/// ```
;
// Main entry point
=> ;
}