Skip to main content

intersects

Function intersects 

Source
pub fn intersects(
    lhs: &PathPattern,
    rhs: &PathPattern,
) -> Result<bool, GlobIntersectError>
Expand description

Does the matched set of lhs overlap that of rhs?

The check is sound (no false positives, no false negatives) across the three pattern-pair shapes:

  • literal/literal: byte-equal comparison of the canonical forms.
  • literal/glob: the literal is tested against the compiled glob matcher.
  • glob/glob: a product-DFA emptiness check via [super::glob_intersect].

Both patterns are assumed to be in the same coordinate system (typically canonicalised workspace-absolute).

ยงErrors

Returns [GlobIntersectError] only for the glob/glob arm, when the underlying DFA construction or anchored-start lookup fails. The literal arms are infallible.