[][src]Struct sana_core::automata::Automata

pub struct Automata<T> {
    pub states: Vec<State<T>>,
    pub edges: BTreeMap<(usize, CharRange), usize>,
}

Finite state automata

Fields

states: Vec<State<T>>edges: BTreeMap<(usize, CharRange), usize>

Implementations

impl<T> Automata<T>[src]

pub fn get(&self, ix: usize) -> Option<&State<T>>[src]

Get a state by index

pub fn insert_state(&mut self, state: State<T>)[src]

Insert state into the automata

pub fn insert_edge(&mut self, from: usize, to: usize, range: CharRange)[src]

Insert transition from state with index from to state with index to with the character range range

pub fn transitions_from(
    &self,
    state: usize
) -> impl Iterator<Item = (&CharRange, usize)>
[src]

An iterator of all transitions from the given state

pub fn transite(&self, state: usize, ch: char) -> Option<usize>[src]

Follow a transition from the given state that by the given char

pub fn find_terminal_node(&self) -> usize[src]

Find the terminal node of the automata

pub fn node_kinds(&self) -> Vec<NodeKind>[src]

Return a list of node kinds of the automata states

The indices of kinds in the list match the indices of corresponding states in the automata

Trait Implementations

impl<T: Clone> Clone for Automata<T>[src]

impl<T: Debug> Debug for Automata<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Automata<T> where
    T: RefUnwindSafe

impl<T> Send for Automata<T> where
    T: Send

impl<T> Sync for Automata<T> where
    T: Sync

impl<T> Unpin for Automata<T> where
    T: Unpin

impl<T> UnwindSafe for Automata<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.