pub enum State {
Nfa(State),
IbMatcher {
matcher: IbMatcher<'static>,
next: StateID,
},
Callback {
callback: Callback,
next: StateID,
},
}
regex-automata
and regex-nfa
only.Expand description
A state in an NFA.
In theory, it can help to conceptualize an NFA
as a graph consisting of
State
s. Each State
contains its complete set of outgoing transitions.
In practice, it can help to conceptualize an NFA
as a sequence of
instructions for a virtual machine. Each State
says what to do and where
to go next.
Strictly speaking, the practical interpretation is the most correct one,
because of the Capture
state. Namely, a Capture
state always forwards execution to another state unconditionally. Its only
purpose is to cause a side effect: the recording of the current input
position at a particular location in memory. In this sense, an NFA
has more power than a theoretical non-deterministic finite automaton.
For most uses of this crate, it is likely that one may never even need to
be aware of this type at all. The main use cases for looking at State
s
directly are if you need to write your own search implementation or if you
need to do some kind of analysis on the NFA.
Variants§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for State
impl !RefUnwindSafe for State
impl !Send for State
impl !Sync for State
impl Unpin for State
impl !UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more