pub trait Automaton<T> {
type State<'a>
where Self: 'a;
// Required methods
fn initial_state(&self) -> Option<Self::State<'_>>;
fn next_state<'a>(
&'a self,
current_state: Self::State<'a>,
token: T,
) -> Option<Self::State<'a>>;
fn is_final_state<'a>(&'a self, state: &Self::State<'a>) -> bool;
// Provided method
fn contains(&self, tokens: impl IntoIterator<Item = T>) -> bool { ... }
}Expand description
Deterministic or non-deterministic automaton.
Required Associated Types§
Required Methods§
fn initial_state(&self) -> Option<Self::State<'_>>
fn next_state<'a>( &'a self, current_state: Self::State<'a>, token: T, ) -> Option<Self::State<'a>>
fn is_final_state<'a>(&'a self, state: &Self::State<'a>) -> bool
Provided Methods§
fn contains(&self, tokens: impl IntoIterator<Item = T>) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.