combine::parser::byte

Function bytes

Source
pub fn bytes<'a, I>(s: &'static [u8]) -> Bytes<I>
where I: Stream<Item = u8, Range = &'a [u8]>, I::Error: ParseError<I::Item, I::Range, I::Position>,
Expand description

Parses the bytes s.

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(&b"rust"[..])
    .parse(&b"rust"[..])
    .map(|x| x.0);
assert_eq!(result, Ok(&b"rust"[..]));