Function regex_automata::util::prefilter::prefixes
source · pub(crate) fn prefixes<H>(kind: MatchKind, hirs: &[H]) -> Seq
Expand description
Extracts all of the prefix literals from the given HIR expressions into a
single Seq
. The literals in the sequence are ordered with respect to the
order of the given HIR expressions and consistent with the match semantics
given.
The sequence returned is “optimized.” That is, they may be shrunk or even truncated according to heuristics with the intent of making them more useful as a prefilter. (Which translates to both using faster algorithms and minimizing the false positive rate.)
Note that this erases any connection between the literals and which pattern (or patterns) they came from.
The match kind given must correspond to the match semantics of the regex that is represented by the HIRs given. The match semantics may change the literal sequence returned.