Trait email_parser::fsm::FSM

source ·
pub trait FSM<S> {
    type Symbol;

    // Required methods
    fn transition(state: S, symbol: Self::Symbol) -> S;
    fn is_final(state: &S) -> bool;
    fn start() -> S;
}
Expand description

FSM is an abstraction over behavior of deterministic finite automata. A DFA has a set of states (generic type S) and alphabets (all possible symbols). One of them is a start state (start fn). A transition takes the DFA from one state to other by consuming a symbol. If the input is completely consumed and DFA is in a final state (or accepting state) then we say that the input belongs to the language accepted by the DFA.

Required Associated Types§

Required Methods§

source

fn transition(state: S, symbol: Self::Symbol) -> S

source

fn is_final(state: &S) -> bool

source

fn start() -> S

Implementors§

source§

impl FSM<State> for State

State implements FSM and defines a DFA for language accepting all valid email addresses. The set of states in DFA is itself. All transitions are defined in the implementation itself. Start state of DFA is State::AddrSpec.

§

type Symbol = char