Struct aho_corasick::util::alphabet::ByteClassSet
source · pub(crate) struct ByteClassSet(ByteSet);
Expand description
A partitioning of bytes into equivalence classes.
A byte class set keeps track of an approximation of equivalence classes of bytes during NFA construction. That is, every byte in an equivalence class cannot discriminate between a match and a non-match.
Note that this may not compute the minimal set of equivalence classes. Basically, any byte in a pattern given to the noncontiguous NFA builder will automatically be treated as its own equivalence class. All other bytes—any byte not in any pattern—will be treated as their own equivalence classes. In theory, all bytes not in any pattern should be part of a single equivalence class, but in practice, we only treat contiguous ranges of bytes as an equivalence class. So the number of classes computed may be bigger than necessary. This usually doesn’t make much of a difference, and keeps the implementation simple.
Tuple Fields§
§0: ByteSet
Implementations§
source§impl ByteClassSet
impl ByteClassSet
sourcepub(crate) fn empty() -> Self
pub(crate) fn empty() -> Self
Create a new set of byte classes where all bytes are part of the same equivalence class.
sourcepub(crate) fn set_range(&mut self, start: u8, end: u8)
pub(crate) fn set_range(&mut self, start: u8, end: u8)
Indicate the the range of byte given (inclusive) can discriminate a match between it and all other bytes outside of the range.
sourcepub(crate) fn byte_classes(&self) -> ByteClasses
pub(crate) fn byte_classes(&self) -> ByteClasses
Convert this boolean set to a map that maps all byte values to their corresponding equivalence class. The last mapping indicates the largest equivalence class identifier (which is never bigger than 255).
Trait Implementations§
source§impl Clone for ByteClassSet
impl Clone for ByteClassSet
source§fn clone(&self) -> ByteClassSet
fn clone(&self) -> ByteClassSet
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more