Function tracery::flatten_map [−][src]
pub fn flatten_map<I, K, C, S>(iter: I) -> Result<String> where
I: IntoIterator<Item = (K, C)>,
K: Into<String>,
C: IntoIterator<Item = S>,
S: Into<String>,
Creates a new grammar from an input map, then uses it to create a random output string, using the “origin” rule
Examples
let map = hashmap! { "origin" => vec![ "#tool# is #description#!" ], "tool" => vec![ "tracery" ], "description" => vec![ "fun", "awesome" ] }; // Generate an output (either "tracery is fun!" or "tracery is awesome!") let output = tracery::flatten_map(map)?;