Skip to main content

CandidateMatcher

Trait CandidateMatcher 

Source
pub trait CandidateMatcher {
    // Required method
    fn matches(
        &self,
        var: &str,
        pos: usize,
        labels: &[String],
    ) -> impl Future<Output = StreamExecutorResult<bool>> + Send;
}
Expand description

Decides whether the row at a physical position can be bound to a pattern variable, given the variables already bound to the earlier rows of the in-progress match. This is how DEFINE predicates are evaluated during matching: a predicate may reference the current row, its physical neighbours (PREV/NEXT), and the running values of other pattern variables (e.g. A.price), so membership cannot be precomputed independently of the match path.

Required Methods§

Source

fn matches( &self, var: &str, pos: usize, labels: &[String], ) -> impl Future<Output = StreamExecutorResult<bool>> + Send

labels[k] is the variable bound to the match’s k-th row; the candidate is the row at pos = match_start + labels.len(). The returned future is Send so the matcher composes with the (boxed, Send) executor stream.

Contract for callers: membership MUST be queried before var is appended to labels, so labels covers only the already-bound rows and never the candidate. Consequently a matcher that resolves running navigation over var itself must treat var as the implicit trailing label. Every caller MUST follow the same rule: the finder and the eviction walker share one matcher, so a caller that pushed first would make the two disagree about which rows satisfy a variable — and eviction would then delete rows the matcher still needs.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§