oni_comb_parser_rs::prelude

Function elm

Source
pub fn elm<'a, I>(element: I) -> Parser<'a, I, I>
where I: Element + Clone + PartialEq + 'a,
Expand description

Returns a Parser that parses the specified element.
指定した要素を解析するParserを返します。

  • element: an element
  • element: 要素

§Example

use oni_comb_parser_rs::prelude::*;

let text: &str = "x";
let input: Vec<char> = text.chars().collect::<Vec<_>>();

let parser: Parser<char, char> = elm('x');

let result: ParseResult<char, char> = parser.parse(&input);

assert!(result.is_success());
assert_eq!(result.success().unwrap(), input[0]);