Struct regex_automata::nfa::thompson::DenseTransitions
source · 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<DenseTransitions> for DenseTransitions
impl PartialEq<DenseTransitions> for DenseTransitions
source§fn eq(&self, other: &DenseTransitions) -> bool
fn eq(&self, other: &DenseTransitions) -> bool
self
and other
values to be equal, and is used
by ==
.