#iterator #unzip #tuple #proc-macro #procedural #generate #n-sized

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

#320 in Procedural macros

Download history 12672/week @ 2023-11-23 15450/week @ 2023-11-30 15687/week @ 2023-12-07 14698/week @ 2023-12-14 9391/week @ 2023-12-21 9202/week @ 2023-12-28 16065/week @ 2024-01-04 19720/week @ 2024-01-11 21881/week @ 2024-01-18 26367/week @ 2024-01-25 23657/week @ 2024-02-01 27573/week @ 2024-02-08 21625/week @ 2024-02-15 20911/week @ 2024-02-22 19942/week @ 2024-02-29 13273/week @ 2024-03-07

80,852 downloads per month
Used in 121 crates (10 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

~1.5MB
~34K SLoC