Skip to main content

Chain

Struct Chain 

Source
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>
where S: Send + Sync + 'static, O: Operator<S> + Send + Sync, Sc: Score + 'static,

Source

pub fn new(tree: O, next_binding: u32) -> Self

Wraps an existing operator tree as a chain whose next joined collection takes next_binding.

Source

pub fn filter<P>(self, predicate: P) -> Chain<S, FilterNode<O, P>, Sc>
where P: for<'a> FilterPredicate<S, O::View<'a>> + 'static, FilterNode<O, P>: Operator<S>,

Adds a row filter. The filter receives the whole borrowed typed row and the solution, and is applied exactly once on every path.

Source

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.key on a Pair)
  • 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.

Source

pub fn penalize<W>(self, weight: W) -> ChainBuilder<S, O, W, Sc>
where W: for<'a> Fn(&S, &O::View<'a>) -> Sc + Send + Sync,

Finalizes into the generic operator terminal, scoring with a weight that receives the whole borrowed typed row.

Source

pub fn reward<W>(self, weight: W) -> ChainBuilder<S, O, W, Sc>
where W: for<'a> Fn(&S, &O::View<'a>) -> Sc + Send + Sync,

Finalizes into the generic operator terminal as a reward.

Auto Trait Implementations§

§

impl<S, O, Sc> Forget for Chain<S, O, Sc>

§

impl<S, O, Sc> Freeze for Chain<S, O, Sc>
where O: Freeze, PhantomData<fn() -> (S, Sc)>: Freeze,

§

impl<S, O, Sc> RefUnwindSafe for Chain<S, O, Sc>

§

impl<S, O, Sc> Send for Chain<S, O, Sc>
where O: Send, PhantomData<fn() -> (S, Sc)>: Send,

§

impl<S, O, Sc> Sync for Chain<S, O, Sc>
where O: Sync, PhantomData<fn() -> (S, Sc)>: Sync,

§

impl<S, O, Sc> Unpin for Chain<S, O, Sc>
where O: Unpin, PhantomData<fn() -> (S, Sc)>: Unpin,

§

impl<S, O, Sc> UnsafeUnpin for Chain<S, O, Sc>

§

impl<S, O, Sc> UnwindSafe for Chain<S, O, Sc>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.