[][src]Function abnf::rule

pub fn rule(input: &str) -> Result<Rule, ParseError>

Parses a single ABNF rule. Returns Ok(Rule) when everything went well and Err(ParsingError) in case of syntax errors.

Note: input must end with a newline and whitespace must not appear before the rulename. (This may be relaxed in the future.)


use abnf::rule;

match rule("a = b / c / *d\n") {
   Ok(rules) => println!("{:#?}", rules),
   Err(error) => eprintln!("{}", error),