Function tracery::from_map[][src]

pub fn from_map<I, K, C, S>(iter: I) -> Result<Grammar> where
    I: IntoIterator<Item = (K, C)>,
    K: Into<String>,
    C: IntoIterator<Item = S>,
    S: Into<String>, 

Creates a new grammar from an input map

Examples

let map = hashmap! {
    "origin" => vec![ "#tool# is #description#!" ],
    "tool" => vec![ "tracery" ],
    "description" => vec![ "fun", "awesome" ]
};
let g = tracery::from_map(map)?;