Struct aho_corasick::util::prefilter::RareByteOffset
source · struct RareByteOffset {
max: u8,
}
Expand description
Offsets associated with an occurrence of a “rare” byte in any of the patterns used to construct a single Aho-Corasick automaton.
Fields§
§max: u8
The maximum offset at which a particular byte occurs from the start
of any pattern. This is used as a shift amount. That is, when an
occurrence of this byte is found, the candidate position reported by
the prefilter is position_of_byte - max
, such that the automaton
will begin its search at a position that is guaranteed to observe a
match.
To avoid accidentally quadratic behavior, a prefilter is considered ineffective when it is asked to start scanning from a position that it has already scanned past.
Using a u8
here means that if we ever see a pattern that’s longer
than 255 bytes, then the entire rare byte prefilter is disabled.
Implementations§
source§impl RareByteOffset
impl RareByteOffset
sourcefn new(max: usize) -> Option<RareByteOffset>
fn new(max: usize) -> Option<RareByteOffset>
Create a new rare byte offset. If the given offset is too big, then None is returned. In that case, callers should render the rare bytes prefilter inert.
Trait Implementations§
source§impl Clone for RareByteOffset
impl Clone for RareByteOffset
source§fn clone(&self) -> RareByteOffset
fn clone(&self) -> RareByteOffset
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RareByteOffset
impl Debug for RareByteOffset
source§impl Default for RareByteOffset
impl Default for RareByteOffset
source§fn default() -> RareByteOffset
fn default() -> RareByteOffset
impl Copy for RareByteOffset
Auto Trait Implementations§
impl Freeze for RareByteOffset
impl RefUnwindSafe for RareByteOffset
impl Send for RareByteOffset
impl Sync for RareByteOffset
impl Unpin for RareByteOffset
impl UnwindSafe for RareByteOffset
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)