Enum aho_corasick::automaton::Candidate
source · [−]pub enum Candidate {
None,
Match(Match),
PossibleStartOfMatch(usize),
}
Expand description
A candidate is the result of running a prefilter on a haystack at a particular position.
The result is either no match, a confirmed match or a possible match.
When no match is returned, the prefilter is guaranteeing that no possible match can be found in the haystack, and the caller may trust this. That is, all correct prefilters must never report false negatives.
In some cases, a prefilter can confirm a match very quickly, in which case, the caller may use this to stop what it’s doing and report the match. In this case, prefilter implementations must never report a false positive. In other cases, the prefilter can only report a potential match, in which case the callers must attempt to confirm the match. In this case, prefilter implementations are permitted to return false positives.
Variants
None
No match was found. Since false negatives are not possible, this means the search can quit as it is guaranteed not to find another match.
Match(Match)
A confirmed match was found. Callers do not need to confirm it.
PossibleStartOfMatch(usize)
The start of a possible match was found. Callers must confirm it before reporting it as a match.
Implementations
sourceimpl Candidate
impl Candidate
sourcepub fn into_option(self) -> Option<usize>
pub fn into_option(self) -> Option<usize>
Convert this candidate into an option. This is useful when callers do not distinguish between true positives and false positives (i.e., the caller must always confirm the match).