|
@@ -133,22 +133,24 @@ impl<
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-/// Filter on the keying index
|
|
|
|
-pub(crate) struct KeyComponent<
|
|
|
|
|
|
+/// Filter on an index
|
|
|
|
+pub(crate) struct IndexComponent<
|
|
E: Entity,
|
|
E: Entity,
|
|
Parent: Queryable,
|
|
Parent: Queryable,
|
|
- EL: QueryEquivalentList<<E::Keys as EntityPartList>::DatumList>,
|
|
|
|
|
|
+ EPL: EntityPartList<Entity = E>,
|
|
|
|
+ EL: QueryEquivalentList<EPL::DatumList>,
|
|
> {
|
|
> {
|
|
datum: EL,
|
|
datum: EL,
|
|
parent: Parent,
|
|
parent: Parent,
|
|
- _ghost: std::marker::PhantomData<E>,
|
|
|
|
|
|
+ _ghost: std::marker::PhantomData<(E, EPL)>,
|
|
}
|
|
}
|
|
|
|
|
|
impl<
|
|
impl<
|
|
E: Entity,
|
|
E: Entity,
|
|
Parent: Queryable,
|
|
Parent: Queryable,
|
|
- EL: QueryEquivalentList<<E::Keys as EntityPartList>::DatumList>,
|
|
|
|
- > KeyComponent<E, Parent, EL>
|
|
|
|
|
|
+ EPL: EntityPartList<Entity = E>,
|
|
|
|
+ EL: QueryEquivalentList<EPL::DatumList>,
|
|
|
|
+ > IndexComponent<E, Parent, EPL, EL>
|
|
{
|
|
{
|
|
pub fn new(parent: Parent, datum: EL) -> Self {
|
|
pub fn new(parent: Parent, datum: EL) -> Self {
|
|
Self {
|
|
Self {
|
|
@@ -162,8 +164,9 @@ impl<
|
|
impl<
|
|
impl<
|
|
E: Entity,
|
|
E: Entity,
|
|
Parent: Queryable,
|
|
Parent: Queryable,
|
|
- EL: QueryEquivalentList<<E::Keys as EntityPartList>::DatumList>,
|
|
|
|
- > Clone for KeyComponent<E, Parent, EL>
|
|
|
|
|
|
+ EPL: EntityPartList<Entity = E>,
|
|
|
|
+ EL: QueryEquivalentList<EPL::DatumList>,
|
|
|
|
+ > Clone for IndexComponent<E, Parent, EPL, EL>
|
|
{
|
|
{
|
|
fn clone(&self) -> Self {
|
|
fn clone(&self) -> Self {
|
|
Self {
|
|
Self {
|
|
@@ -177,11 +180,17 @@ impl<
|
|
/// this workaround is needed because we very explicitly would like EL to not be a
|
|
/// this workaround is needed because we very explicitly would like EL to not be a
|
|
/// 'static-restricted type, and it doesn't matter for the purposes of actually distinguishing
|
|
/// 'static-restricted type, and it doesn't matter for the purposes of actually distinguishing
|
|
/// between queries.
|
|
/// between queries.
|
|
-pub(crate) struct CanonicalUniqueComponent<E: Entity, Parent: Queryable> {
|
|
|
|
- _ghost: std::marker::PhantomData<(E, Parent)>,
|
|
|
|
|
|
+pub(crate) struct CanonicalIndexComponent<
|
|
|
|
+ E: Entity,
|
|
|
|
+ Parent: Queryable,
|
|
|
|
+ EPL: EntityPartList<Entity = E>,
|
|
|
|
+> {
|
|
|
|
+ _ghost: std::marker::PhantomData<(E, Parent, EPL)>,
|
|
}
|
|
}
|
|
|
|
|
|
-impl<E: Entity, Parent: Queryable + 'static> Queryable for CanonicalUniqueComponent<E, Parent> {
|
|
|
|
|
|
+impl<E: Entity, Parent: Queryable + 'static, EPL: EntityPartList<Entity = E>> Queryable
|
|
|
|
+ for CanonicalIndexComponent<E, Parent, EPL>
|
|
|
|
+{
|
|
type EntityOutput = E;
|
|
type EntityOutput = E;
|
|
type OutputContainer = Option<Stored<E>>;
|
|
type OutputContainer = Option<Stored<E>>;
|
|
type StaticVersion = Self;
|
|
type StaticVersion = Self;
|
|
@@ -197,7 +206,9 @@ impl<E: Entity, Parent: Queryable + 'static> Queryable for CanonicalUniqueCompon
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl<E: Entity, Parent: Queryable + 'static> Clone for CanonicalUniqueComponent<E, Parent> {
|
|
|
|
|
|
+impl<E: Entity, Parent: Queryable + 'static, EPL: EntityPartList<Entity = E>> Clone
|
|
|
|
+ for CanonicalIndexComponent<E, Parent, EPL>
|
|
|
|
+{
|
|
fn clone(&self) -> Self {
|
|
fn clone(&self) -> Self {
|
|
Self {
|
|
Self {
|
|
_ghost: Default::default(),
|
|
_ghost: Default::default(),
|
|
@@ -208,12 +219,13 @@ impl<E: Entity, Parent: Queryable + 'static> Clone for CanonicalUniqueComponent<
|
|
impl<
|
|
impl<
|
|
E: Entity,
|
|
E: Entity,
|
|
Parent: Queryable,
|
|
Parent: Queryable,
|
|
- EL: QueryEquivalentList<<E::Keys as EntityPartList>::DatumList>,
|
|
|
|
- > Queryable for KeyComponent<E, Parent, EL>
|
|
|
|
|
|
+ EPL: EntityPartList<Entity = E>,
|
|
|
|
+ EL: QueryEquivalentList<EPL::DatumList>,
|
|
|
|
+ > Queryable for IndexComponent<E, Parent, EPL, EL>
|
|
{
|
|
{
|
|
type EntityOutput = E;
|
|
type EntityOutput = E;
|
|
type OutputContainer = Option<Stored<E>>;
|
|
type OutputContainer = Option<Stored<E>>;
|
|
- type StaticVersion = CanonicalUniqueComponent<E, Parent::StaticVersion>;
|
|
|
|
|
|
+ type StaticVersion = CanonicalIndexComponent<E, Parent::StaticVersion, EPL>;
|
|
|
|
|
|
fn build(&self) -> Query {
|
|
fn build(&self) -> Query {
|
|
let mut query = self.parent.build();
|
|
let mut query = self.parent.build();
|
|
@@ -233,7 +245,7 @@ impl<
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- <E::Keys>::accept_part_visitor(&mut PartVisitor::<E>(&mut query, Default::default()));
|
|
|
|
|
|
+ EPL::accept_part_visitor(&mut PartVisitor::<E>(&mut query, Default::default()));
|
|
|
|
|
|
query
|
|
query
|
|
}
|
|
}
|