Enum Candidate
pub 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(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) -> 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).
Trait Implementations
impl Clone for Candidate
fn clone(&self) -> Self
impl Debug for Candidate
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
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
Blanket Implementations
impl<T> Any for Candidate
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Candidate
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Candidate
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Candidate
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Candidate
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Candidate
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Candidate
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Candidate
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Candidate
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>