|
@@ -1,8 +1,8 @@
|
|
|
use crate::{
|
|
|
- schema::datum::Datum,
|
|
|
db::{Connection, DBConnection},
|
|
|
- schema::entity::{Entity, EntityPartList, EntityVisitor},
|
|
|
query,
|
|
|
+ schema::datum::Datum,
|
|
|
+ schema::entity::{Entity, EntityPartList, EntityVisitor},
|
|
|
};
|
|
|
use crate::{DBError, DBResult};
|
|
|
|
|
@@ -15,7 +15,6 @@ pub(crate) mod meta;
|
|
|
#[cfg(test)]
|
|
|
mod tests;
|
|
|
|
|
|
-
|
|
|
// ----------------------------------------------------------------------
|
|
|
// API types
|
|
|
// ----------------------------------------------------------------------
|
|
@@ -65,7 +64,6 @@ impl<T: Entity> std::ops::DerefMut for IDWrap<T> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// ----------------------------------------------------------------------
|
|
|
// Entity field types
|
|
|
// ----------------------------------------------------------------------
|
|
@@ -100,7 +98,7 @@ pub trait Relation: 'static {
|
|
|
/// XXX: we want to be able to derive a string name from a Relation instance, preferably without
|
|
|
/// another proc macro, and without relying on RTTI that could change between compilations. how?
|
|
|
///
|
|
|
-/// -> can use a regular macro to automatically declare tag struct and impl Relation
|
|
|
+/// -> can use a regular macro to automatically declare tag struct and impl Relation
|
|
|
|
|
|
/// Opaque data structure used for constructing `Assoc{Map,Domain,Range}` instances.
|
|
|
pub struct AssocData {
|
|
@@ -163,7 +161,10 @@ impl<T: Entity> Datum for AssocMap<T> {
|
|
|
v.visit::<T>();
|
|
|
}
|
|
|
|
|
|
- fn accept_discriminator(d: &mut impl DatumDiscriminator) where Self: Sized {
|
|
|
+ fn accept_discriminator(d: &mut impl DatumDiscriminator)
|
|
|
+ where
|
|
|
+ Self: Sized,
|
|
|
+ {
|
|
|
d.visit_assoc_map::<T>();
|
|
|
}
|
|
|
|
|
@@ -227,7 +228,10 @@ impl<R: Relation> Datum for AssocDomain<R> {
|
|
|
v.visit::<R::Domain>();
|
|
|
}
|
|
|
|
|
|
- fn accept_discriminator(d: &mut impl DatumDiscriminator) where Self: Sized {
|
|
|
+ fn accept_discriminator(d: &mut impl DatumDiscriminator)
|
|
|
+ where
|
|
|
+ Self: Sized,
|
|
|
+ {
|
|
|
d.visit_assoc_domain::<R>();
|
|
|
}
|
|
|
|
|
@@ -274,7 +278,6 @@ impl<R: Relation> AssocRange<R> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
impl<R: Relation> EntityMap for AssocRange<R> {
|
|
|
type ContainedEntity = R::Domain;
|
|
|
|
|
@@ -292,7 +295,10 @@ impl<R: Relation> Datum for AssocRange<R> {
|
|
|
v.visit::<R::Domain>();
|
|
|
}
|
|
|
|
|
|
- fn accept_discriminator(d: &mut impl DatumDiscriminator) where Self: Sized {
|
|
|
+ fn accept_discriminator(d: &mut impl DatumDiscriminator)
|
|
|
+ where
|
|
|
+ Self: Sized,
|
|
|
+ {
|
|
|
d.visit_assoc_range::<R>();
|
|
|
}
|
|
|
|