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

pub fn bytes_cmp<'a, C, I>(s: &'static [u8], cmp: C) -> BytesCmp<C, I> where
    C: FnMut(u8, u8) -> bool,
    I: Stream<Item = u8, Range = &'a [u8]>, 

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""[..])));