[−][src]Function liblet::automaton::automaton_with_q0
pub fn automaton_with_q0<T, Q, I, F>(
transitions: I,
f: F,
q0: Q
) -> Automaton<T> where
T: Eq + Clone + Ord,
I: IntoIterator<Item = Transition<T>>,
Q: IntoIterator<Item = T>,
F: IntoIterator,
F::Item: IntoIterator<Item = T>,
Convenience method for creating a an automaton with a specified q0 state.
It returns the automaton directly, as opposed to the Result
returned from
the automaton with_q0 method.
Panics
Panics if trying to construct the automaton returns an error as specified in the automaton with_q0 method.
Examples
use liblet::automaton::{automaton_with_q0,Transition}; use liblet::symbol::symbol; use std::collections::BTreeSet; let t = Transition::new(vec!["0"], symbol("label"), vec!["1"]); let q0: BTreeSet<&str> = vec!["0"].into_iter().collect(); let mut f: BTreeSet<BTreeSet<&str>> = BTreeSet::new(); f.insert(vec!["1"].into_iter().collect()); // automaton with starting state {"0"} // and final state {"1"} // and transiton "label" from {"0"} to {"1"} let a = automaton_with_q0(vec![t], f, q0);