Struct regex_automata::dfa::onepass::PatternEpsilons
source · struct PatternEpsilons(u64);
Expand description
A representation of a match state’s pattern ID along with the epsilons for when a match occurs.
A match state in a one-pass DFA, unlike in a more general DFA, has exactly one pattern ID. If it had more, then the original NFA would not have been one-pass.
The “epsilons” part of this corresponds to what was found in the epsilon transitions between the transition taken in the last byte of input and the ultimate match state. This might include saving slots and/or conditional epsilon transitions that must be satisfied before one can report the match.
Technically, every state has room for a ‘PatternEpsilons’, but it is only ever non-empty for match states.
Tuple Fields§
§0: u64
Implementations§
source§impl PatternEpsilons
impl PatternEpsilons
const PATTERN_ID_BITS: u64 = 22u64
const PATTERN_ID_SHIFT: u64 = 42u64
const PATTERN_ID_NONE: u64 = 4_194_303u64
const PATTERN_ID_LIMIT: u64 = 4_194_303u64
const PATTERN_ID_MASK: u64 = 18_446_739_675_663_040_512u64
const EPSILONS_MASK: u64 = 4_398_046_511_103u64
sourcefn empty() -> PatternEpsilons
fn empty() -> PatternEpsilons
Return a new empty pattern epsilons that has no pattern ID and has no epsilons. This is suitable for non-match states.
sourcefn is_empty(self) -> bool
fn is_empty(self) -> bool
Whether this pattern epsilons is empty or not. It’s empty when it has no pattern ID and an empty epsilons.
sourcefn pattern_id(self) -> Option<PatternID>
fn pattern_id(self) -> Option<PatternID>
Return the pattern ID in this pattern epsilons if one exists.
sourcefn pattern_id_unchecked(self) -> PatternID
fn pattern_id_unchecked(self) -> PatternID
Returns the pattern ID without checking whether it’s valid. If this is
called and there is no pattern ID in this PatternEpsilons
, then this
will likely produce an incorrect result or possibly even a panic or
an overflow. But safety will not be violated.
This is useful when you know a particular state is a match state. If it’s a match state, then it must have a pattern ID.
sourcefn set_pattern_id(self, pid: PatternID) -> PatternEpsilons
fn set_pattern_id(self, pid: PatternID) -> PatternEpsilons
Return a new pattern epsilons with the given pattern ID, but the same epsilons.
sourcefn set_epsilons(self, epsilons: Epsilons) -> PatternEpsilons
fn set_epsilons(self, epsilons: Epsilons) -> PatternEpsilons
Return a new pattern epsilons with the given epsilons, but the same pattern ID.
Trait Implementations§
source§impl Clone for PatternEpsilons
impl Clone for PatternEpsilons
source§fn clone(&self) -> PatternEpsilons
fn clone(&self) -> PatternEpsilons
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more