[][src]Function liblet::automaton::automaton

pub fn automaton<T, I, F>(transitions: I, f: F) -> Automaton<T> where
    T: Eq + Clone + Ord,
    I: IntoIterator<Item = Transition<T>>,
    F: IntoIterator,
    F::Item: IntoIterator<Item = T>, 

Convenience method for creating a an automaton.

It returns the automaton directly, as opposed to the Result returned from the automaton new method.

Panics

Panics if trying to construct the automaton returns an error as specified in the automaton new method.

Examples

use liblet::automaton::{automaton,Transition};
use liblet::symbol::symbol;
use std::collections::BTreeSet;

let t = Transition::new(vec!["0"], symbol("label"), vec!["1"]);
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(vec![t], f);