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

source

pub(crate) fn empty() -> Self

Create a new set of byte classes where all bytes are part of the same equivalence class.

source

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.

source

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

source§

fn clone(&self) -> ByteClassSet

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ByteClassSet

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ByteClassSet

source§

fn default() -> ByteClassSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.