1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::ops::{Range, RangeInclusive};

use super::Transpose;

macro_rules! impl_transpose {
    ($($t:ident: $a:ident;$b:ident),*) => {

impl<$($t),*> Transpose for Range<($($t),*)> {
    type Output = ($(Range<$t>),*);

    fn transpose(self) -> Self::Output {
        let Range { start: ($($a),*), end: ($($b),*) } = self;
        ($($a..$b),*)
    }
}

impl<$($t),*> Transpose for RangeInclusive<($($t),*)> {
    type Output = ($(RangeInclusive<$t>),*);

    fn transpose(self) -> Self::Output {
        let (($($a),*), ($($b),*)) = self.into_inner();
        ($($a..=$b),*)
    }
}

    };
}

impl_transpose!(T0: a0;b0, T1: a1;b1);
impl_transpose!(T0: a0;b0, T1: a1;b1, T2: a2;b2);
impl_transpose!(T0: a0;b0, T1: a1;b1, T2: a2;b2, T3: a3;b3);