#iterator #unzip

macro unzip-n

Procedural macro to generate unzip for iterators over n-sized tuples

3 releases

0.1.2 Jul 5, 2020
0.1.1 Sep 4, 2019
0.1.0 Sep 4, 2019

#312 in Procedural macros

Download history 8454/week @ 2022-08-12 6558/week @ 2022-08-19 5254/week @ 2022-08-26 6086/week @ 2022-09-02 6670/week @ 2022-09-09 5630/week @ 2022-09-16 8000/week @ 2022-09-23 10993/week @ 2022-09-30 12688/week @ 2022-10-07 11148/week @ 2022-10-14 12852/week @ 2022-10-21 11880/week @ 2022-10-28 11818/week @ 2022-11-04 9740/week @ 2022-11-11 9905/week @ 2022-11-18 8506/week @ 2022-11-25

42,447 downloads per month
Used in 46 crates (9 directly)

MIT/Apache

11KB
106 lines

unzip-n

travis crates.io docs.rs

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]);
}

License

Licensed under either of

at your option.

Contribution

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

Dependencies

~210–610KB
~15K SLoC