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.
extern crate combine;
use combine::*;
use combine::byte::bytes_cmp;
use combine::primitives::Info;
fn main() {
use std::ascii::AsciiExt; let result = bytes_cmp(|l, r| l.eq_ignore_ascii_case(&r), Info::Range(b"abc"[..]), &b"abc"[..]) .parse(&b"AbC"[..]); assert_eq!(result, Ok(&b"abc"[..]));