lattices/ght/
macros.rs
1#[macro_export]
3macro_rules! GhtTypeWithSchema {
7 (() => () => $( $schema:ty ),+ : $storage:ident) => (
9 $crate::ght::GhtLeaf::<$( $schema ),*, () >
10 );
11
12 (() => $( $z:ty ),* => $schema:ty : $storage:ident) => (
14 $crate::ght::GhtLeaf::<$schema, $crate::variadics::var_type!($( $z ),*), $crate::variadics::variadic_collections::$storage<$schema> >
15 );
16
17 ($a:ty => () => $schema:ty : $storage:ident) => (
19 $crate::ght::GhtInner::<$a, $crate::ght::GhtLeaf::<$schema, (), $crate::variadics::variadic_collections::$storage<$schema> >>
20 );
21
22 ($a:ty => $( $z:ty ),* => $schema:ty : $storage:ident) => (
24 $crate::ght::GhtInner::<$a, $crate::ght::GhtLeaf::<$schema, $crate::variadics::var_type!($( $z ),*), $crate::variadics::variadic_collections::$storage<$schema> >>
25 );
26
27 ($a:ty, $( $b:ty ),* => () => $schema:ty : $storage:ident) => (
29 $crate::ght::GhtInner::<$a, $crate::GhtTypeWithSchema!($( $b ),* => () => $schema : $storage)>
30 );
31
32 ($a:ty, $( $b:ty ),* => $( $z:ty ),* => $schema:ty : $storage:ident) => (
34 $crate::ght::GhtInner::<$a, $crate::GhtTypeWithSchema!($( $b ),* => $( $z ),* => $schema : $storage)>
35 );
36}
37
38#[macro_export]
39macro_rules! GhtType {
59 (() => $( $z:ty ),*: $storage:ident) => (
61 $crate::GhtTypeWithSchema!(() => $( $z ),* => $crate::variadics::var_type!($( $z ),*): $storage)
62 );
63
64 ($( $b:ty ),* => (): $storage:ident) => (
66 $crate::GhtTypeWithSchema!($( $b ),* => () => $crate::variadics::var_type!($( $b ),*): $storage)
67 );
68
69 ($( $b:ty ),* => $( $z:ty ),*: $storage:ident) => (
71 $crate::GhtTypeWithSchema!($( $b ),* => $( $z ),* => $crate::variadics::var_type!($( $b ),*, $( $z ),*): $storage)
72 );
73}
74
75#[macro_export]
76macro_rules! ColtType {
85 ($a:ty => ()) => {
87 $crate::variadics::var_type!($crate::GhtType!($a => (): VariadicColumnMultiset))
88 };
89 ($a:ty => $c:ty) => {
91 ($crate::GhtType!($a => $c: VariadicColumnMultiset), $crate::ColtType!($a, $c => ()))
92 };
93 ($a:ty => $c:ty, $( $d:ty ),*) => {
95 ($crate::GhtType!($a => $c, $( $d ),*: VariadicColumnMultiset), $crate::ColtType!($a, $c => $( $d ),*))
96 };
97 ($a:ty, $( $b:ty ),* => ()) => {
99 $crate::variadics::var_type!($crate::GhtType!($a, $( $b ),* => (): VariadicColumnMultiset))
100 };
101 ($a:ty, $( $b:ty ),* => $c:ty) => {
103 ($crate::GhtType!($a, $( $b ),* => $c: VariadicColumnMultiset), $crate::ColtType!($a, $( $b ),*, $c => ()))
104 };
105 ($a:ty, $( $b:ty ),* => $c:ty, $( $d:ty ),*) => {
107 ($crate::GhtType!($a, $( $b ),* => $c, $( $d ),*: VariadicColumnMultiset), $crate::ColtType!($a, $( $b ),*, $c => $( $d ),*))
108 };
109 ($a:ty) => {
111 ($crate::GhtType!(() => $a: VariadicColumnMultiset), $crate::ColtType!($a => ()))
112 };
113 ($a:ty, $( $b:ty ),*) => {
115 ($crate::GhtType!(() => $a, $( $b ),*: VariadicColumnMultiset), $crate::ColtType!($a => $( $b ),*))
116 };
117}