[][src]Function combine::parser::byte::bytes_cmp

pub fn bytes_cmp<'a, 'b, C, I>(
    s: &'static [u8],
    cmp: C
) -> impl Parser<Input = I, Output = &'a [u8]> where
    C: FnMut(u8, u8) -> bool,
    I: Stream<Item = u8, Range = &'b [u8]>,
    I::Error: ParseError<I::Item, I::Range, I::Position>, 

Parses the bytes s using cmp to compare each token.

If you have a stream implementing RangeStream such as &[u8] you can also use the range parser which may be more efficient.

use std::ascii::AsciiExt;
let result = bytes_cmp(&b"abc"[..], |l, r| l.eq_ignore_ascii_case(&r))
    .parse(&b"AbC"[..]);
assert_eq!(result, Ok((&b"abc"[..], &b""[..])));