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 more