pub struct Chain<S: 'static, O, Sc>where
O: Operator<S>,{ /* private fields */ }Expand description
A typed join chain of unbounded depth.
O is the concrete operator tree (a JoinNode, optionally wrapped in a
FilterNode); next_binding is the binding index the next joined collection
receives, so repeated descriptors stay distinguishable.
Implementations§
Source§impl<S, O, Sc> Chain<S, O, Sc>
impl<S, O, Sc> Chain<S, O, Sc>
Sourcepub fn new(tree: O, next_binding: u32) -> Self
pub fn new(tree: O, next_binding: u32) -> Self
Wraps an existing operator tree as a chain whose next joined
collection takes next_binding.
Sourcepub fn filter<P>(self, predicate: P) -> Chain<S, FilterNode<O, P>, Sc>
pub fn filter<P>(self, predicate: P) -> Chain<S, FilterNode<O, P>, Sc>
Adds a row filter. The filter receives the whole borrowed typed row and the solution, and is applied exactly once on every path.
Sourcepub fn join<B, EB, P>(
self,
target: (EB, P),
) -> Chain<S, JoinNode<S, O, CollectionNode<S, EB>, P::Plan>, Sc>where
B: Clone + Send + Sync + 'static,
EB: CollectionExtract<S, Item = B> + 'static,
P: CompileCondition + 'static,
for<'a> P::Plan: IndexedPlan + ExecutablePlan<O::View<'a>, Leaf<'a, B>>,
for<'a> CollectionNode<S, EB>: Operator<S, View<'a> = Leaf<'a, B>>,
JoinNode<S, O, CollectionNode<S, EB>, P::Plan>: Operator<S>,
pub fn join<B, EB, P>(
self,
target: (EB, P),
) -> Chain<S, JoinNode<S, O, CollectionNode<S, EB>, P::Plan>, Sc>where
B: Clone + Send + Sync + 'static,
EB: CollectionExtract<S, Item = B> + 'static,
P: CompileCondition + 'static,
for<'a> P::Plan: IndexedPlan + ExecutablePlan<O::View<'a>, Leaf<'a, B>>,
for<'a> CollectionNode<S, EB>: Operator<S, View<'a> = Leaf<'a, B>>,
JoinNode<S, O, CollectionNode<S, EB>, P::Plan>: Operator<S>,
Extends the chain with one more source.
The target’s condition compiles fresh, so its left key receives the whole
borrowed row (O::View<'a>) and target’s 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, spelled here as
|row: &O::View<'_>| ...(e.g.row.left.entity.keyon aPair) - right key —
|c: &Leaf<'_, B>| c.entity.key, reading fields via.entity
equal_bi with entity closures does NOT typecheck here (E0631, expected
a closure over the row view) — use equal_on. The first join of a chain
keeps equal_bi with plain entity keys.
Sourcepub fn penalize<W>(self, weight: W) -> ChainBuilder<S, O, W, Sc>
pub fn penalize<W>(self, weight: W) -> ChainBuilder<S, O, W, Sc>
Finalizes into the generic operator terminal, scoring with a weight that receives the whole borrowed typed row.