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

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).

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.