pub struct Tri<S, A, B, C, EA, EB, EC, P1, P2, F, Sc>where
Sc: Score,
P1: CompileCondition<Plan: IndexedPlan>,
P2: CompileCondition<Plan: IndexedPlan>,{ /* private fields */ }Expand description
Three-collection join stream: (A ⋈ B) ⋈ C, with P1 relating A to B
and P2 relating the joined pair to C.
Implementations§
Source§impl<S, A, B, C, EA, EB, EC, P1, P2, F, Sc> Tri<S, A, B, C, EA, EB, EC, P1, P2, F, Sc>where
S: Send + Sync + 'static,
A: Clone + Send + Sync + 'static,
B: Clone + Send + Sync + 'static,
C: Clone + Send + Sync + 'static,
EA: 'static,
EB: 'static,
EC: 'static,
P1: CompileCondition<Plan: IndexedPlan> + 'static,
P2: CompileCondition<Plan: IndexedPlan> + 'static,
for<'a> <P1 as CompileCondition>::Plan: ExecutablePlan<Leaf<'a, A>, Leaf<'a, B>>,
for<'a> <P2 as CompileCondition>::Plan: ExecutablePlan<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>,
JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>: Operator<S>,
JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>: Operator<S>,
F: TriFilter<S, A, B, C>,
Sc: Score + 'static,
impl<S, A, B, C, EA, EB, EC, P1, P2, F, Sc> Tri<S, A, B, C, EA, EB, EC, P1, P2, F, Sc>where
S: Send + Sync + 'static,
A: Clone + Send + Sync + 'static,
B: Clone + Send + Sync + 'static,
C: Clone + Send + Sync + 'static,
EA: 'static,
EB: 'static,
EC: 'static,
P1: CompileCondition<Plan: IndexedPlan> + 'static,
P2: CompileCondition<Plan: IndexedPlan> + 'static,
for<'a> <P1 as CompileCondition>::Plan: ExecutablePlan<Leaf<'a, A>, Leaf<'a, B>>,
for<'a> <P2 as CompileCondition>::Plan: ExecutablePlan<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>,
JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>: Operator<S>,
JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>: Operator<S>,
F: TriFilter<S, A, B, C>,
Sc: Score + 'static,
Sourcepub fn filter<P>(
self,
predicate: P,
) -> Tri<S, A, B, C, EA, EB, EC, P1, P2, AndTriFilter<F, FnTriFilter<impl Fn(&S, &A, &B, &C, usize, usize, usize) -> bool + Send + Sync>>, Sc>
pub fn filter<P>( self, predicate: P, ) -> Tri<S, A, B, C, EA, EB, EC, P1, P2, AndTriFilter<F, FnTriFilter<impl Fn(&S, &A, &B, &C, usize, usize, usize) -> bool + Send + Sync>>, Sc>
Adds a filter predicate to the stream.
Sourcepub fn join<D, ED, P3>(
self,
target: (ED, P3),
) -> Quad<S, A, B, C, D, EA, EB, EC, ED, P1, P2, P3, TriAsQuadFilter<F, A, B, C>, Sc>where
D: Clone + Send + Sync + 'static,
ED: CollectionExtract<S, Item = D> + 'static,
P3: CompileCondition + 'static,
for<'a> P3::Plan: IndexedPlan + ExecutablePlan<Pair<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>, Leaf<'a, D>>,
for<'a> JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>: Operator<S, View<'a> = Pair<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>>,
for<'a> JoinNode<S, JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>, CollectionNode<S, ED>, <P3 as CompileCondition>::Plan>: Operator<S>,
pub fn join<D, ED, P3>(
self,
target: (ED, P3),
) -> Quad<S, A, B, C, D, EA, EB, EC, ED, P1, P2, P3, TriAsQuadFilter<F, A, B, C>, Sc>where
D: Clone + Send + Sync + 'static,
ED: CollectionExtract<S, Item = D> + 'static,
P3: CompileCondition + 'static,
for<'a> P3::Plan: IndexedPlan + ExecutablePlan<Pair<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>, Leaf<'a, D>>,
for<'a> JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>: Operator<S, View<'a> = Pair<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>>,
for<'a> JoinNode<S, JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>, CollectionNode<S, ED>, <P3 as CompileCondition>::Plan>: Operator<S>,
Extends this triple with a fourth source D.
The target tuple’s condition compiles fresh, so its left closure receives the whole borrowed (A, B, C) row and the fourth key domain is independent of every earlier relationship.
§Key shapes
Later joins of a chain take VIEW keys, not entity keys:
- left key — the whole borrowed row so far (for a Tri this is
&Pair<Pair<Leaf<'_, A>, Leaf<'_, B>>, Leaf<'_, C>>) - right key —
&Leaf<'_, D>of the new entity, reading fields via.entity
equal_bi with entity closures does NOT typecheck here (E0631, expected
fn(&Pair<...>)) — use equal_on. The first join of a chain keeps
equal_bi with plain entity keys.
Sourcepub fn penalize<W>(
self,
weight: W,
) -> Builder<S, A, B, C, EA, EB, EC, P1, P2, F, impl Fn(&A, &B, &C) -> Sc + Send + Sync, Sc>
pub fn penalize<W>( self, weight: W, ) -> Builder<S, A, B, C, EA, EB, EC, P1, P2, F, impl Fn(&A, &B, &C) -> Sc + Send + Sync, Sc>
Penalizes each match by weight.
weight is a fixed score, or a closure over the matched (&A, &B, &C)
triple returning one.
A fixed weight with a non-zero hard level marks the constraint hard; closures
are soft unless wrapped in hard_weight.
Sourcepub fn reward<W>(
self,
weight: W,
) -> Builder<S, A, B, C, EA, EB, EC, P1, P2, F, impl Fn(&A, &B, &C) -> Sc + Send + Sync, Sc>
pub fn reward<W>( self, weight: W, ) -> Builder<S, A, B, C, EA, EB, EC, P1, P2, F, impl Fn(&A, &B, &C) -> Sc + Send + Sync, Sc>
Rewards each match by weight.
weight is a fixed score, or a closure over the matched (&A, &B, &C)
triple returning one.
A fixed weight with a non-zero hard level marks the constraint hard; closures
are soft unless wrapped in hard_weight.
Source§impl<S, A, B, C, EA, EB, EC, P1, P2, F, Sc> Tri<S, A, B, C, EA, EB, EC, P1, P2, F, Sc>where
S: Send + Sync + 'static,
A: Clone + Send + Sync + 'static,
B: Clone + Send + Sync + 'static,
C: Clone + Send + Sync + 'static,
EA: 'static,
EB: 'static,
EC: 'static,
P1: CompileCondition<Plan: IndexedPlan> + 'static,
P2: CompileCondition<Plan: IndexedPlan> + 'static,
for<'a> JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>: Operator<S, View<'a> = Pair<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>> + Send + Sync,
F: TriFilter<S, A, B, C> + 'static,
Sc: Score + 'static,
impl<S, A, B, C, EA, EB, EC, P1, P2, F, Sc> Tri<S, A, B, C, EA, EB, EC, P1, P2, F, Sc>where
S: Send + Sync + 'static,
A: Clone + Send + Sync + 'static,
B: Clone + Send + Sync + 'static,
C: Clone + Send + Sync + 'static,
EA: 'static,
EB: 'static,
EC: 'static,
P1: CompileCondition<Plan: IndexedPlan> + 'static,
P2: CompileCondition<Plan: IndexedPlan> + 'static,
for<'a> JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>: Operator<S, View<'a> = Pair<Pair<Leaf<'a, A>, Leaf<'a, B>>, Leaf<'a, C>>> + Send + Sync,
F: TriFilter<S, A, B, C> + 'static,
Sc: Score + 'static,
Sourcepub fn group_by<GK, GF, Co, V, R, Acc>(
self,
key: GF,
collector: Co,
) -> JoinedGroupedStream<S, FilterNode<JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>, impl Fn(&S, &Pair<Pair<Leaf<'_, A>, Leaf<'_, B>>, Leaf<'_, C>>) -> bool + Send + Sync>, impl Fn(&Pair<Pair<Leaf<'_, A>, Leaf<'_, B>>, Leaf<'_, C>>) -> GK + Send + Sync, TupleCollector<Co, V, R, Acc>, GK, V, R, Acc, Sc>
pub fn group_by<GK, GF, Co, V, R, Acc>( self, key: GF, collector: Co, ) -> JoinedGroupedStream<S, FilterNode<JoinNode<S, JoinNode<S, CollectionNode<S, EA>, CollectionNode<S, EB>, <P1 as CompileCondition>::Plan>, CollectionNode<S, EC>, <P2 as CompileCondition>::Plan>, impl Fn(&S, &Pair<Pair<Leaf<'_, A>, Leaf<'_, B>>, Leaf<'_, C>>) -> bool + Send + Sync>, impl Fn(&Pair<Pair<Leaf<'_, A>, Leaf<'_, B>>, Leaf<'_, C>>) -> GK + Send + Sync, TupleCollector<Co, V, R, Acc>, GK, V, R, Acc, Sc>
Groups joined tuples by a key and an owned-value collector. Upstream filters remain binding on full and incremental evaluation.