Function selectors::matching::matches_selector

source ยท
pub fn matches_selector<E>(
    selector: &Selector<E::Impl>,
    offset: usize,
    hashes: Option<&AncestorHashes>,
    element: &E,
    context: &mut MatchingContext<'_, E::Impl>,
) -> bool
where E: Element,
Expand description

Matches a selector, fast-rejecting against a bloom filter.

We accept an offset to allow consumers to represent and match against partial selectors (indexed from the right). We use this API design, rather than having the callers pass a SelectorIter, because creating a SelectorIter requires dereferencing the selector to get the length, which adds an unncessary cache miss for cases when we can fast-reject with AncestorHashes (which the caller can store inline with the selector pointer).