Automaton

Trait Automaton 

Source
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§

Source

type State<'a> where Self: 'a

Required Methods§

Source

fn initial_state(&self) -> Option<Self::State<'_>>

Source

fn next_state<'a>( &'a self, current_state: Self::State<'a>, token: T, ) -> Option<Self::State<'a>>

Source

fn is_final_state<'a>(&'a self, state: &Self::State<'a>) -> bool

Provided Methods§

Source

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.

Implementors§

Source§

impl<Q: Ord + Hash, T: Token, G> Automaton<T> for TaggedNFA<Q, T, G>

Source§

type State<'a> = VisitingState<'a, Q> where Self: 'a

Source§

impl<T: Token, Q: Ord + Hash> Automaton<T> for NFA<Q, T>

Source§

type State<'a> = VisitingState<'a, Q> where Self: 'a