|
@@ -66,161 +66,48 @@ impl<P0: EntityPart> EntityPartList for (P0,) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl<P0: EntityPart, P1: EntityPart> EntityPartList for (P0, P1) {
|
|
|
- type DatumList = (P0::Datum, P1::Datum);
|
|
|
-
|
|
|
- fn build_datum_list(conn: &Connection, stmt: &mut StatementRow) -> DBResult<Self::DatumList> {
|
|
|
- let local_id: i64 = stmt.read(0)?;
|
|
|
- let mut idx = 1; // starting index is 1 since index 0 is the ID
|
|
|
- build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
-
|
|
|
- Ok((d0, d1))
|
|
|
- }
|
|
|
-
|
|
|
- fn accept_part_visitor(v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit::<P0>();
|
|
|
- v.visit::<P1>();
|
|
|
- }
|
|
|
- fn accept_part_visitor_ref(datum_list: &Self::DatumList, v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit_datum::<P0>(&datum_list.0);
|
|
|
- v.visit_datum::<P1>(&datum_list.1);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-impl<P0: EntityPart, P1: EntityPart, P2: EntityPart> EntityPartList for (P0, P1, P2) {
|
|
|
- type DatumList = (P0::Datum, P1::Datum, P2::Datum);
|
|
|
-
|
|
|
- fn build_datum_list(conn: &Connection, stmt: &mut StatementRow) -> DBResult<Self::DatumList> {
|
|
|
- let local_id: i64 = stmt.read(0)?;
|
|
|
- let mut idx = 1; // starting index is 1 since index 0 is the ID
|
|
|
- build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
-
|
|
|
- Ok((d0, d1, d2))
|
|
|
- }
|
|
|
-
|
|
|
- fn accept_part_visitor(v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit::<P0>();
|
|
|
- v.visit::<P1>();
|
|
|
- v.visit::<P2>();
|
|
|
- }
|
|
|
- fn accept_part_visitor_ref(datum_list: &Self::DatumList, v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit_datum::<P0>(&datum_list.0);
|
|
|
- v.visit_datum::<P1>(&datum_list.1);
|
|
|
- v.visit_datum::<P2>(&datum_list.2);
|
|
|
+macro_rules! part_list_impl {
|
|
|
+ ($($p:ident : $d:ident : $n:tt),+) => {
|
|
|
+ impl< $( $p : EntityPart ),* > EntityPartList for ( $($p),* ) {
|
|
|
+ type DatumList = ( $( $p :: Datum ),* );
|
|
|
+
|
|
|
+ fn build_datum_list(conn: &Connection, stmt: &mut StatementRow) -> DBResult<Self::DatumList> {
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
|
+ let mut idx = 1;
|
|
|
+ $(
|
|
|
+ build_datum!(conn, local_id, stmt, idx, $d, $p);
|
|
|
+ )*
|
|
|
+
|
|
|
+ Ok(( $( $d ),* ))
|
|
|
+ }
|
|
|
+
|
|
|
+ fn accept_part_visitor(v: &mut impl EntityPartVisitor) {
|
|
|
+ $(
|
|
|
+ v.visit::< $p >();
|
|
|
+ )*
|
|
|
+ }
|
|
|
+
|
|
|
+ fn accept_part_visitor_ref(datum_list: &Self::DatumList, v: &mut impl EntityPartVisitor) {
|
|
|
+ $(
|
|
|
+ v.visit_datum::< $p >(&datum_list . $n);
|
|
|
+ )*
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl<P0: EntityPart, P1: EntityPart, P2: EntityPart, P3: EntityPart> EntityPartList
|
|
|
- for (P0, P1, P2, P3)
|
|
|
-{
|
|
|
- type DatumList = (P0::Datum, P1::Datum, P2::Datum, P3::Datum);
|
|
|
-
|
|
|
- fn build_datum_list(conn: &Connection, stmt: &mut StatementRow) -> DBResult<Self::DatumList> {
|
|
|
- let local_id: i64 = stmt.read(0)?;
|
|
|
- let mut idx = 1; // starting index is 1 since index 0 is the ID
|
|
|
- build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d3, P3);
|
|
|
-
|
|
|
- Ok((d0, d1, d2, d3))
|
|
|
- }
|
|
|
-
|
|
|
- fn accept_part_visitor(v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit::<P0>();
|
|
|
- v.visit::<P1>();
|
|
|
- v.visit::<P2>();
|
|
|
- v.visit::<P3>();
|
|
|
- }
|
|
|
- fn accept_part_visitor_ref(datum_list: &Self::DatumList, v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit_datum::<P0>(&datum_list.0);
|
|
|
- v.visit_datum::<P1>(&datum_list.1);
|
|
|
- v.visit_datum::<P2>(&datum_list.2);
|
|
|
- v.visit_datum::<P3>(&datum_list.3);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-impl<P0: EntityPart, P1: EntityPart, P2: EntityPart, P3: EntityPart, P4: EntityPart> EntityPartList
|
|
|
- for (P0, P1, P2, P3, P4)
|
|
|
-{
|
|
|
- type DatumList = (P0::Datum, P1::Datum, P2::Datum, P3::Datum, P4::Datum);
|
|
|
-
|
|
|
- fn build_datum_list(conn: &Connection, stmt: &mut StatementRow) -> DBResult<Self::DatumList> {
|
|
|
- let local_id: i64 = stmt.read(0)?;
|
|
|
- let mut idx = 1; // starting index is 1 since index 0 is the ID
|
|
|
- build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d3, P3);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d4, P4);
|
|
|
-
|
|
|
- Ok((d0, d1, d2, d3, d4))
|
|
|
- }
|
|
|
-
|
|
|
- fn accept_part_visitor(v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit::<P0>();
|
|
|
- v.visit::<P1>();
|
|
|
- v.visit::<P2>();
|
|
|
- v.visit::<P3>();
|
|
|
- v.visit::<P4>();
|
|
|
- }
|
|
|
- fn accept_part_visitor_ref(datum_list: &Self::DatumList, v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit_datum::<P0>(&datum_list.0);
|
|
|
- v.visit_datum::<P1>(&datum_list.1);
|
|
|
- v.visit_datum::<P2>(&datum_list.2);
|
|
|
- v.visit_datum::<P3>(&datum_list.3);
|
|
|
- v.visit_datum::<P4>(&datum_list.4);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-impl<
|
|
|
- P0: EntityPart,
|
|
|
- P1: EntityPart,
|
|
|
- P2: EntityPart,
|
|
|
- P3: EntityPart,
|
|
|
- P4: EntityPart,
|
|
|
- P5: EntityPart,
|
|
|
- > EntityPartList for (P0, P1, P2, P3, P4, P5)
|
|
|
-{
|
|
|
- type DatumList = (
|
|
|
- P0::Datum,
|
|
|
- P1::Datum,
|
|
|
- P2::Datum,
|
|
|
- P3::Datum,
|
|
|
- P4::Datum,
|
|
|
- P5::Datum,
|
|
|
- );
|
|
|
-
|
|
|
- fn build_datum_list(conn: &Connection, stmt: &mut StatementRow) -> DBResult<Self::DatumList> {
|
|
|
- let local_id: i64 = stmt.read(0)?;
|
|
|
- let mut idx = 1; // starting index is 1 since index 0 is the ID
|
|
|
- build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d3, P3);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d4, P4);
|
|
|
- build_datum!(conn, local_id, stmt, idx, d5, P5);
|
|
|
-
|
|
|
- Ok((d0, d1, d2, d3, d4, d5))
|
|
|
- }
|
|
|
-
|
|
|
- fn accept_part_visitor(v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit::<P0>();
|
|
|
- v.visit::<P1>();
|
|
|
- v.visit::<P2>();
|
|
|
- v.visit::<P3>();
|
|
|
- v.visit::<P4>();
|
|
|
- v.visit::<P5>();
|
|
|
- }
|
|
|
- fn accept_part_visitor_ref(datum_list: &Self::DatumList, v: &mut impl EntityPartVisitor) {
|
|
|
- v.visit_datum::<P0>(&datum_list.0);
|
|
|
- v.visit_datum::<P1>(&datum_list.1);
|
|
|
- v.visit_datum::<P2>(&datum_list.2);
|
|
|
- v.visit_datum::<P3>(&datum_list.3);
|
|
|
- v.visit_datum::<P4>(&datum_list.4);
|
|
|
- v.visit_datum::<P5>(&datum_list.5);
|
|
|
- }
|
|
|
-}
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9, P10:d10:10);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9, P10:d10:10, P11:d11:11);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9, P10:d10:10, P11:d11:11, P12:d12:12);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9, P10:d10:10, P11:d11:11, P12:d12:12, P13:d13:13);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9, P10:d10:10, P11:d11:11, P12:d12:12, P13:d13:13, P14:d14:14);
|
|
|
+part_list_impl!(P0:d0:0, P1:d1:1, P2:d2:2, P3:d3:3, P4:d4:4, P5:d5:5, P6:d6:6, P7:d7:7, P8:d8:8, P9:d9:9, P10:d10:10, P11:d11:11, P12:d12:12, P13:d13:13, P14:d14:14, P15:d15:15);
|