Struct regex_automata::dfa::onepass::Transition

source ·
struct Transition(u64);
Expand description

Represents a single transition in a one-pass DFA.

The high 21 bits corresponds to the state ID. The bit following corresponds to the special “match wins” flag. The remaining low 42 bits corresponds to the transition epsilons, which contains the slots that should be saved when this transition is followed and the conditional epsilon transitions that must be satisfied in order to follow this transition.

Tuple Fields§

§0: u64

Implementations§

source§

impl Transition

source

const STATE_ID_BITS: u64 = 21u64

source

const STATE_ID_SHIFT: u64 = 43u64

source

const STATE_ID_LIMIT: u64 = 2_097_152u64

source

const MATCH_WINS_SHIFT: u64 = 42u64

source

const INFO_MASK: u64 = 4_398_046_511_103u64

source

fn new(match_wins: bool, sid: StateID, epsilons: Epsilons) -> Transition

Return a new transition to the given state ID with the given epsilons.

source

fn is_dead(self) -> bool

Returns true if and only if this transition points to the DEAD state.

source

fn match_wins(&self) -> bool

Return whether this transition has a “match wins” property.

When a transition has this property, it means that if a match has been found and the search uses leftmost-first semantics, then that match should be returned immediately instead of continuing on.

The “match wins” name comes from RE2, which uses a pretty much identical mechanism for implementing leftmost-first semantics.

source

fn state_id(&self) -> StateID

Return the “next” state ID that this transition points to.

source

fn set_state_id(&mut self, sid: StateID)

Set the “next” state ID in this transition.

source

fn epsilons(&self) -> Epsilons

Return the epsilons embedded in this transition.

Trait Implementations§

source§

impl Clone for Transition

source§

fn clone(&self) -> Transition

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 Transition

source§

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

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

impl PartialEq for Transition

source§

fn eq(&self, other: &Transition) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Transition

source§

impl Eq for Transition

source§

impl StructuralPartialEq for Transition

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.