pub struct DenseTransitions {
pub transitions: Box<[StateID]>,
}
Expand description
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§
source§impl DenseTransitions
impl DenseTransitions
sourcepub fn matches(&self, haystack: &[u8], at: usize) -> Option<StateID>
pub 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
.
sourcepub fn matches_byte(&self, byte: u8) -> Option<StateID>
pub 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
.
If at >= haystack.len()
, then this returns None
.
Trait Implementations§
source§impl Clone for DenseTransitions
impl Clone for DenseTransitions
source§fn clone(&self) -> DenseTransitions
fn clone(&self) -> DenseTransitions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DenseTransitions
impl Debug for DenseTransitions
source§impl PartialEq for DenseTransitions
impl PartialEq for DenseTransitions
impl Eq for DenseTransitions
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 UnwindSafe for DenseTransitions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)