Struct regex_automata::nfa::thompson::SparseTransitions
source · pub struct SparseTransitions {
pub transitions: Box<[Transition]>,
}
Expand description
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§
source§impl SparseTransitions
impl SparseTransitions
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 matching byte
range (there is at most one) corresponding to the position at
in
haystack
.
If at >= haystack.len()
, then this returns None
.
sourcepub(crate) fn matches_unit(&self, unit: Unit) -> Option<StateID>
pub(crate) fn matches_unit(&self, unit: Unit) -> Option<StateID>
This follows the matching transition for any member of the alphabet.
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 the given alphabet unit is EOI
,
then this always 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 matching byte range (there is at most one) corresponding to the byte given.
Trait Implementations§
source§impl Clone for SparseTransitions
impl Clone for SparseTransitions
source§fn clone(&self) -> SparseTransitions
fn clone(&self) -> SparseTransitions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SparseTransitions
impl Debug for SparseTransitions
source§impl PartialEq for SparseTransitions
impl PartialEq for SparseTransitions
source§fn eq(&self, other: &SparseTransitions) -> bool
fn eq(&self, other: &SparseTransitions) -> bool
self
and other
values to be equal, and is used
by ==
.