Skip to main content

State

Trait State 

Source
pub trait State<Σ: Eq + Hash + Copy> {
    type Index;

    // Required methods
    fn get_transition(&self, symbol: Self::Index) -> Option<&Self>;
    fn add_transition(&mut self, transition: (Σ, Option<&Self>));
    fn set_accept(&mut self, accept: bool);
    fn is_accept(&self) -> bool;
}
Expand description

A node in the DFA, contains is_accept and a transition hashmap. MARK: State

Required Associated Types§

Source

type Index

The type of the index used to access transitions in the hashmap.

Required Methods§

Source

fn get_transition(&self, symbol: Self::Index) -> Option<&Self>

Returns the next state given the provided symbol, if it exists.

Source

fn add_transition(&mut self, transition: (Σ, Option<&Self>))

Adds a transition to the hashmap. None represents a self-transition.

Source

fn set_accept(&mut self, accept: bool)

Sets the accept state flag.

Source

fn is_accept(&self) -> bool

Returns the accept state flag.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Σ: Eq + Hash + Copy + Indexable> State<Σ> for CompleteState<Σ>

Source§

impl<Σ: Eq + Hash + Copy> State<Σ> for PartialState<Σ>

Source§

type Index = Σ