Enum Candidate
enum Candidate
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(crate::util::search::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
impl Candidate
fn into_option(self: 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).
impl Clone for Candidate
fn clone(self: &Self) -> Candidate
impl Debug for Candidate
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Freeze for Candidate
impl RefUnwindSafe for Candidate
impl Send for Candidate
impl Sync for Candidate
impl Unpin for Candidate
impl UnsafeUnpin for Candidate
impl UnwindSafe for Candidate
impl<T> Any for Candidate
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Candidate
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Candidate
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Candidate
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Candidate
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Candidate
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Candidate
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Candidate
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Candidate
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>