dimensioned::__make_types! [] [src]

macro_rules! __make_types {
    // this first arm filters out the end Types into Zeros with Num, so we go from say
    // (One | Meters, Seconds | Meters, Seconds) to (One, Zero | Meters, Seconds |
    // Meters) and then we move to a different branch I would like a cleaner way to
    // create the list $Num, Zero, Zero, ... but I have yet to find one.
    ($System: ident, $($Nums: ident),+ | $($Types: ident),+ | $DeadType: ident, $($Others: ident),* | $($New: ident),*) => (
        __make_types!($System, $($Nums),+, Zero | $($Types),+ | $($Others),* | $DeadType $(, $New)*);
        );
    // This branch creates our Unitless type and then trims off the last $Type that we no longer need:
    ($System: ident, $First: ident, $($Nums: ident),* | $($Types: ident),+ | $Type: ident | $($New: ident),+) => (
        pub type Unitless = $System<Zero, $($Nums),*>;
        impl Dimensionless for Unitless {}
        __make_types!($System, $($Nums),*, $First | $Type, $($New),* );
        );
    // Create the type, cycle the numbers, then call again:
    ($System: ident, $First: ident, $($Nums: ident),* | $Type: ident, $($Types: ident),+) => (
        pub type $Type = $System<$First, $($Nums),*>;
        __make_types!($System, $($Nums),*, $First | $($Types),*);
        );
    ($System: ident, $($Nums: ident),* | $Type: ident) => (
        pub type $Type = $System<$($Nums),*>;
        );
}