Function combine::parser::char::string_cmp
source · pub fn string_cmp<C, I>(s: &'static str, cmp: C) -> StrCmp<C, I>where
C: FnMut(char, char) -> bool,
I: Stream<Item = char>,
I::Error: ParseError<I::Item, I::Range, I::Position>,
Expand description
Parses the string s
, using cmp
to compare each character.
use std::ascii::AsciiExt;
let result = string_cmp("rust", |l, r| l.eq_ignore_ascii_case(&r))
.parse("RusT")
.map(|x| x.0);
assert_eq!(result, Ok("rust"));