Crates.io | unzip-n |
lib.rs | unzip-n |
version | 0.1.2 |
source | src |
created_at | 2019-09-04 14:31:16.658611 |
updated_at | 2020-07-05 19:53:09.819709 |
description | Procedural macro to generate `unzip` for iterators over n-sized tuples |
homepage | https://github.com/mexus/unzip-n |
repository | https://github.com/mexus/unzip-n |
max_upload_size | |
id | 162137 |
size | 22,921 |
Procedural macro for unzipping iterators-over-n
-length-tuples into n
collections.
Here's a brief example of what it is capable of:
use unzip_n::unzip_n;
unzip_n!(pub 3);
// // Or simply leave the visibility modifier absent for inherited visibility
// // (which usually means "private").
// unzip_n!(3);
fn main() {
let v = vec![(1, 2, 3), (4, 5, 6)];
let (v1, v2, v3) = v.into_iter().unzip_n_vec();
assert_eq!(v1, &[1, 4]);
assert_eq!(v2, &[2, 5]);
assert_eq!(v3, &[3, 6]);
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
License: MIT/Apache-2.0