Function itertools::multiunzip
source · pub fn multiunzip<FromI, I>(i: I) -> FromI
Expand description
Converts an iterator of tuples into a tuple of containers.
unzip()
consumes an entire iterator of n-ary tuples, producing n
collections, one for each
column.
This function is, in some sense, the opposite of multizip
.
use itertools::multiunzip;
let inputs = vec![(1, 2, 3), (4, 5, 6), (7, 8, 9)];
let (a, b, c): (Vec<_>, Vec<_>, Vec<_>) = multiunzip(inputs);
assert_eq!(a, vec![1, 4, 7]);
assert_eq!(b, vec![2, 5, 8]);
assert_eq!(c, vec![3, 6, 9]);