Struct regex_automata::nfa::thompson::literal_trie::Frame

source ·
struct Frame<'a> {
    chunks: StateChunksIter<'a>,
    transitions: Iter<'a, Transition>,
    union: Vec<StateID>,
    sparse: Vec<Transition>,
}
Expand description

An explicit stack frame used for traversing the trie without using recursion.

Each frame is tied to the traversal of a single trie state. The frame is dropped once the entire state (and all of its children) have been visited. The “output” of compiling a state is the ‘union’ vector, which is turn converted to a NFA union state. Each branch of the union corresponds to a chunk in the trie state.

‘sparse’ corresponds to the set of transitions for a particular chunk in a trie state. It is ultimately converted to an NFA sparse state. The ‘sparse’ field, after being converted to a sparse NFA state, is reused for any subsequent chunks in the trie state, if any exist.

Fields§

§chunks: StateChunksIter<'a>

The remaining chunks to visit for a trie state.

§transitions: Iter<'a, Transition>

The transitions of the current chunk that we’re iterating over. Since every trie state has at least one chunk, every frame is initialized with the first chunk’s transitions ready to be consumed.

§union: Vec<StateID>

The NFA state IDs pointing to the start of each chunk compiled by this trie state. This ultimately gets converted to an NFA union once the entire trie state (and all of its children) have been compiled. The order of these matters for leftmost-first match semantics, since earlier matches in the union are preferred over later ones.

§sparse: Vec<Transition>

The actual NFA transitions for a single chunk in a trie state. This gets converted to an NFA sparse state, and its corresponding NFA state ID should get added to ‘union’.

Implementations§

source§

impl<'a> Frame<'a>

source

fn new(state: &'a State) -> Frame<'a>

Create a new stack frame for trie traversal. This initializes the ‘transitions’ iterator to the transitions for the first chunk, with the ‘chunks’ iterator being every chunk after the first one.

Trait Implementations§

source§

impl<'a> Debug for Frame<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Frame<'a>

§

impl<'a> RefUnwindSafe for Frame<'a>

§

impl<'a> Send for Frame<'a>

§

impl<'a> Sync for Frame<'a>

§

impl<'a> Unpin for Frame<'a>

§

impl<'a> UnwindSafe for Frame<'a>

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, 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.