#iterator #unzip #tuple #visibility

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

#493 in Procedural macros

Download history 8669/week @ 2024-12-27 19687/week @ 2025-01-03 24221/week @ 2025-01-10 22926/week @ 2025-01-17 21657/week @ 2025-01-24 24883/week @ 2025-01-31 24482/week @ 2025-02-07 22071/week @ 2025-02-14 25676/week @ 2025-02-21 25987/week @ 2025-02-28 29428/week @ 2025-03-07 30776/week @ 2025-03-14 30373/week @ 2025-03-21 27829/week @ 2025-03-28 33742/week @ 2025-04-04 22201/week @ 2025-04-11

120,452 downloads per month
Used in 127 crates (13 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
~38K SLoC