Skip to main content

intersect

Function intersect 

Source
pub fn intersect(a: &str, b: &str) -> Option<String>
Expand description

The exact intersection of two patterns, if the fragment can express it.

Returns the resource denoting precisely what both patterns admit, or None when they admit nothing in common or the pair is undecidable.

The decidable fragment is closed under intersection, which is what makes meet exact rather than approximate: a literal meets * as that literal, * meets * as *, and a trailing ** yields whatever the other side has left. Picking one side and discarding the other instead would break associativity — /* and /a/** share /a, and a rule that dropped the pair would lose it.