pub struct Automaton<T>where
T: Eq,{ /* private fields */ }
Implementations§
source§impl<T> Automaton<T>where
T: Eq,
impl<T> Automaton<T>where
T: Eq,
sourcepub fn add_state(&mut self) -> StateIndex
pub fn add_state(&mut self) -> StateIndex
Adds a state in the automaton and return it’s StateIndex.
sourcepub fn add_edge(&mut self, source: StateIndex, target: StateIndex, value: T)
pub fn add_edge(&mut self, source: StateIndex, target: StateIndex, value: T)
Adds an edge to the automaton, requires the starting state, the ending state and a value of type T representing the transition value.
sourcepub fn set_start(&mut self, new_start: StateIndex)
pub fn set_start(&mut self, new_start: StateIndex)
Sets the starting state of the automaton.
sourcepub fn add_end(&mut self, new_end: StateIndex)
pub fn add_end(&mut self, new_end: StateIndex)
Adds an accepting state to the automaton.
sourcepub fn consume(&mut self, val: T)
pub fn consume(&mut self, val: T)
Consumes a value and advances, if the value is not present in some transition then it stays in the same state.
sourcepub fn accepted(&self) -> bool
pub fn accepted(&self) -> bool
Returns a boolean value telling if the current state is an accepting state.
sourcepub fn current(&self) -> StateIndex
pub fn current(&self) -> StateIndex
Returns StateIndex of the current value.