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

pub fn bytes_cmp<'a, 'b, C, Input>(
    s: &'static [u8],
    cmp: C
) -> bytes_cmp<'a, 'b, C, Input> where
    <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
    Input: Stream,
    C: FnMut(u8, u8) -> bool,
    Input: Stream<Token = u8, Range = &'b [u8]>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position>, 
Expand description

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.

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