pub fn bytes<'a, 'b, Input>(s: &'static [u8]) -> bytes<'a, 'b, Input> where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream,
Input: Stream<Token = u8, Range = &'b [u8]>,
Input::Error: ParseError<Input::Token, Input::Range, Input::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"[..]));