#[non_exhaustive]pub enum Prefilter {
None,
Auto,
}
Expand description
Prefilter controls whether heuristics are used to accelerate searching.
A prefilter refers to the idea of detecting candidate matches very quickly, and then confirming whether those candidates are full matches. This idea can be quite effective since it’s often the case that looking for candidates can be a lot faster than running a complete substring search over the entire input. Namely, looking for candidates can be done with extremely fast vectorized code.
The downside of a prefilter is that it assumes false positives (which are candidates generated by a prefilter that aren’t matches) are somewhat rare relative to the frequency of full matches. That is, if a lot of false positives are generated, then it’s possible for search time to be worse than if the prefilter wasn’t enabled in the first place.
Another downside of a prefilter is that it can result in highly variable performance, where some cases are extraordinarily fast and others aren’t. Typically, variable performance isn’t a problem, but it may be for your use case.
The use of prefilters in this implementation does use a heuristic to detect when a prefilter might not be carrying its weight, and will dynamically disable its use. Nevertheless, this configuration option gives callers the ability to disable prefilters if you have knowledge that they won’t be useful.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
Never used a prefilter in substring search.
Auto
Automatically detect whether a heuristic prefilter should be used. If it is used, then heuristics will be used to dynamically disable the prefilter if it is believed to not be carrying its weight.
Trait Implementations§
Source§impl Clone for PrefilterConfig
impl Clone for PrefilterConfig
Source§fn clone(&self) -> PrefilterConfig
fn clone(&self) -> PrefilterConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PrefilterConfig
impl Debug for PrefilterConfig
Source§impl Default for PrefilterConfig
impl Default for PrefilterConfig
Source§fn default() -> PrefilterConfig
fn default() -> PrefilterConfig
impl Copy for PrefilterConfig
Auto Trait Implementations§
impl Freeze for PrefilterConfig
impl RefUnwindSafe for PrefilterConfig
impl Send for PrefilterConfig
impl Sync for PrefilterConfig
impl Unpin for PrefilterConfig
impl UnwindSafe for PrefilterConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
None
: 0 bytesAuto
: 0 bytes