Struct aho_corasick::util::special::Special

source ·
pub(crate) struct Special {
    pub(crate) max_special_id: StateID,
    pub(crate) max_match_id: StateID,
    pub(crate) start_unanchored_id: StateID,
    pub(crate) start_anchored_id: StateID,
}
Expand description

A collection of sentinel state IDs for Aho-Corasick automata.

This specifically enables the technique by which we determine which states are dead, matches or start states. Namely, by arranging states in a particular order, we can determine the type of a state simply by looking at its ID.

Fields§

§max_special_id: StateID

The maximum ID of all the “special” states. This corresponds either to start_anchored_id when a prefilter is active and max_match_id when a prefilter is not active. The idea here is that if there is no prefilter, then there is no point in treating start states as special.

§max_match_id: StateID

The maximum ID of all the match states. Any state ID bigger than this is guaranteed to be a non-match ID.

It is possible and legal for max_match_id to be equal to start_anchored_id, which occurs precisely in the case where the empty string is a pattern that was added to the underlying automaton.

§start_unanchored_id: StateID

The state ID of the start state used for unanchored searches.

§start_anchored_id: StateID

The state ID of the start state used for anchored searches. This is always start_unanchored_id+1.

Implementations§

source§

impl Special

source

pub(crate) fn zero() -> Special

Create a new set of “special” state IDs with all IDs initialized to zero. The general idea here is that they will be updated and set to correct values later.

Trait Implementations§

source§

impl Clone for Special

source§

fn clone(&self) -> Special

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 Special

source§

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

Formats the value using the given formatter. 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.