|
@@ -1,77 +1,89 @@
|
|
-use super::{Datum, DatumList, DatumListRef, DatumVisitor, QueryEquivalent, QueryEquivalentList};
|
|
|
|
|
|
+use super::{
|
|
|
|
+ ConcreteDatum, ConcreteDatumList, Datum, DatumList, DatumVisitor, QueryEquivalent,
|
|
|
|
+ QueryEquivalentList, StringQuery,
|
|
|
|
+};
|
|
|
|
|
|
impl DatumList for () {
|
|
impl DatumList for () {
|
|
- type Ref<'a> = &'a ();
|
|
|
|
fn accept(&self, _: &mut impl DatumVisitor) {}
|
|
fn accept(&self, _: &mut impl DatumVisitor) {}
|
|
-}
|
|
|
|
|
|
|
|
-impl<'l> DatumListRef for &'l () {
|
|
|
|
- fn accept(&self, _: &mut impl DatumVisitor) {}
|
|
|
|
|
|
+ const LEN: usize = 0;
|
|
}
|
|
}
|
|
|
|
|
|
-impl<T: Datum> DatumList for T {
|
|
|
|
- type Ref<'a> = &'a T where Self: 'a;
|
|
|
|
|
|
+impl QueryEquivalentList<()> for () {}
|
|
|
|
|
|
|
|
+impl<T: Datum> DatumList for T {
|
|
fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
visitor.visit(self);
|
|
visitor.visit(self);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ const LEN: usize = 1;
|
|
}
|
|
}
|
|
|
|
|
|
-impl<'l, T: Datum> DatumListRef for &'l T {
|
|
|
|
- fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
|
|
- visitor.visit(self);
|
|
|
|
|
|
+impl<T: ConcreteDatum> ConcreteDatumList for T {
|
|
|
|
+ fn build_equivalent<'l>(from: &'l [&'l str]) -> Option<impl QueryEquivalentList<Self> + 'l> {
|
|
|
|
+ if from.len() != 1 {
|
|
|
|
+ None
|
|
|
|
+ } else {
|
|
|
|
+ Some(StringQuery(from[0]))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl<T: Datum, E: QueryEquivalent<T>> QueryEquivalentList<T> for E {}
|
|
|
|
|
|
+impl<T: ConcreteDatum, E: QueryEquivalent<T>> QueryEquivalentList<T> for E {}
|
|
|
|
|
|
impl<T0: Datum> DatumList for (T0,) {
|
|
impl<T0: Datum> DatumList for (T0,) {
|
|
- type Ref<'a> = (&'a T0,) where Self: 'a;
|
|
|
|
-
|
|
|
|
fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
visitor.visit(&self.0);
|
|
visitor.visit(&self.0);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
-impl<T0: Datum, E0: QueryEquivalent<T0>> QueryEquivalentList<(T0,)> for (E0,) {}
|
|
|
|
|
|
+ const LEN: usize = 1;
|
|
|
|
+}
|
|
|
|
|
|
-impl<'a, T0: Datum> DatumListRef for (&'a T0,) {
|
|
|
|
- fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
|
|
- visitor.visit(&self.0);
|
|
|
|
|
|
+impl<T0: ConcreteDatum> ConcreteDatumList for (T0,) {
|
|
|
|
+ fn build_equivalent<'l>(from: &'l [&'l str]) -> Option<impl QueryEquivalentList<Self> + 'l> {
|
|
|
|
+ if from.len() != 1 {
|
|
|
|
+ None
|
|
|
|
+ } else {
|
|
|
|
+ Some((StringQuery(from[0]),))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+impl<T0: ConcreteDatum, E0: QueryEquivalent<T0>> QueryEquivalentList<(T0,)> for (E0,) {}
|
|
|
|
+
|
|
macro_rules! datum_list {
|
|
macro_rules! datum_list {
|
|
- ($($ty:ident : $e:ident : $n:tt),+) => {
|
|
|
|
|
|
+ ($len:literal, $($ty:ident : $e:ident : $n:tt),+) => {
|
|
impl<$($ty: Datum),*> DatumList for ($($ty),*) {
|
|
impl<$($ty: Datum),*> DatumList for ($($ty),*) {
|
|
- type Ref<'a> = ($(&'a $ty),*) where Self: 'a;
|
|
|
|
fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
$(visitor.visit(&self. $n));*
|
|
$(visitor.visit(&self. $n));*
|
|
}
|
|
}
|
|
|
|
+ const LEN: usize = $len;
|
|
}
|
|
}
|
|
|
|
|
|
- impl<'l, $($ty: Datum),*> DatumListRef for ($(&'l $ty),*) {
|
|
|
|
- fn accept(&self, visitor: &mut impl DatumVisitor) {
|
|
|
|
- $(visitor.visit(&self. $n));*
|
|
|
|
|
|
+ impl<$( $ty: ConcreteDatum, $e: QueryEquivalent<$ty> ),*> QueryEquivalentList<( $( $ty ),* )> for ( $( $e ),* ) {}
|
|
|
|
+
|
|
|
|
+ impl<$( $ty: ConcreteDatum ),*> ConcreteDatumList for ($($ty),*) {
|
|
|
|
+ fn build_equivalent<'l>(from: &'l [&'l str]) -> Option<impl QueryEquivalentList<Self> + 'l> {
|
|
|
|
+ Some((
|
|
|
|
+ $( StringQuery( from.get($n)? ) ),*
|
|
|
|
+ ))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- impl<$( $ty: Datum, $e: QueryEquivalent<$ty> ),*> QueryEquivalentList<( $( $ty ),* )> for ( $( $e ),* ) {}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12, T13:E13:13);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12, T13:E13:13, T14:E14:14);
|
|
|
|
-datum_list!(T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12, T13:E13:13, T14:E14:14, T15:E15:15);
|
|
|
|
|
|
+datum_list!(2, T0:E0:0, T1:E1:1);
|
|
|
|
+datum_list!(3, T0:E0:0, T1:E1:1, T2:E2:2);
|
|
|
|
+datum_list!(4, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3);
|
|
|
|
+datum_list!(5, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4);
|
|
|
|
+datum_list!(6, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5);
|
|
|
|
+datum_list!(7, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6);
|
|
|
|
+datum_list!(8, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7);
|
|
|
|
+datum_list!(9, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8);
|
|
|
|
+datum_list!(10, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9);
|
|
|
|
+datum_list!(11, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10);
|
|
|
|
+datum_list!(12, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11);
|
|
|
|
+datum_list!(13, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12);
|
|
|
|
+datum_list!(14, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12, T13:E13:13);
|
|
|
|
+datum_list!(15, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12, T13:E13:13, T14:E14:14);
|
|
|
|
+datum_list!(16, T0:E0:0, T1:E1:1, T2:E2:2, T3:E3:3, T4:E4:4, T5:E5:5, T6:E6:6, T7:E7:7, T8:E8:8, T9:E9:9, T10:E10:10, T11:E11:11, T12:E12:12, T13:E13:13, T14:E14:14, T15:E15:15);
|