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

source

const PATTERN_ID_BITS: u64 = 22u64

source

const PATTERN_ID_SHIFT: u64 = 42u64

source

const PATTERN_ID_NONE: u64 = 4_194_303u64

source

const PATTERN_ID_LIMIT: u64 = 4_194_303u64

source

const PATTERN_ID_MASK: u64 = 18_446_739_675_663_040_512u64

source

const EPSILONS_MASK: u64 = 4_398_046_511_103u64

source

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.

source

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.

source

fn pattern_id(self) -> Option<PatternID>

Return the pattern ID in this pattern epsilons if one exists.

source

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.

source

fn set_pattern_id(self, pid: PatternID) -> PatternEpsilons

Return a new pattern epsilons with the given pattern ID, but the same epsilons.

source

fn epsilons(self) -> Epsilons

Return the epsilons part of this pattern epsilons.

source

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

source§

fn clone(&self) -> PatternEpsilons

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PatternEpsilons

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for PatternEpsilons

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.