pub struct DenseTransitions {
pub transitions: Box<[StateID]>,
}
nfa-thompson
only.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,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes