Struct SparseTransitions

pub struct SparseTransitions { pub transitions: Box<[Transition]> }

A sequence of transitions used to represent a sparse state.

This is the primary representation of a Sparse state. It corresponds to a sorted sequence of transitions with non-overlapping byte ranges. If the byte at the current position in the haystack matches one of the byte ranges, then the finite state machine should take the corresponding transition.

Fields

transitions: Box<[Transition]>

The sorted sequence of non-overlapping transitions.

Implementations

impl SparseTransitions

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 matching byte range (there is at most one) corresponding to the position at 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 matching byte range (there is at most one) corresponding to the byte given.

Trait Implementations

impl Clone for SparseTransitions

fn clone(&self) -> Self

impl Debug for SparseTransitions

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

impl Eq for SparseTransitions

impl PartialEq for SparseTransitions

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

impl StructuralPartialEq for SparseTransitions

Auto Trait Implementations

impl Freeze for SparseTransitions

impl RefUnwindSafe for SparseTransitions

impl Send for SparseTransitions

impl Sync for SparseTransitions

impl Unpin for SparseTransitions

impl UnsafeUnpin for SparseTransitions

impl UnwindSafe for SparseTransitions

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for SparseTransitions

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T, U> Into<U> for SparseTransitions 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 SparseTransitions where U: Into<T>,

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

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

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