Struct DenseTransitions

pub struct DenseTransitions { pub transitions: Box<[StateID]> }

A sequence of transitions used to represent a dense state.

This is the primary representation of a Dense state. It provides constant time matching. That is, given a byte in a haystack and a DenseTransitions, one can determine if the state matches in constant time.

This is in contrast to SparseTransitions, whose time complexity is necessarily bigger than constant time. Also in contrast, DenseTransitions usually requires (much) more heap memory.

Fields

transitions: Box<[StateID]>

A dense representation of this state's transitions on the heap. This always has length 256.

Implementations

impl DenseTransitions

fn matches(&self, haystack: &[u8], at: usize) -> Option<StateID>

This follows the matching transition for a particular byte.

The matching transition is found by looking for a transition that doesn't correspond to StateID::ZERO for the byte at the given position in haystack.

If at >= haystack.len(), then this returns None.

fn matches_byte(&self, byte: u8) -> Option<StateID>

This follows the matching transition for a particular byte.

The matching transition is found by looking for a transition that doesn't correspond to StateID::ZERO for the given byte.

Trait Implementations

impl Clone for DenseTransitions

fn clone(&self) -> Self

impl Debug for DenseTransitions

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

impl Eq for DenseTransitions

impl PartialEq for DenseTransitions

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for DenseTransitions

Auto Trait Implementations

impl Freeze for DenseTransitions

impl RefUnwindSafe for DenseTransitions

impl Send for DenseTransitions

impl Sync for DenseTransitions

impl Unpin for DenseTransitions

impl UnsafeUnpin for DenseTransitions

impl UnwindSafe for DenseTransitions

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for DenseTransitions where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for DenseTransitions

fn from(t: T) -> T

Returns the argument unchanged.

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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