elm_ref

Function elm_ref 

Source
pub fn elm_ref<'a, I>(element: I) -> Parser<'a, I, &'a I>
where I: Element,
Expand description

Returns a Parser that parses the specified element.(for reference)

  • element: element

ยงExample


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

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

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

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