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

pub fn take_until_byte2<Input>(a: u8, b: u8) -> TakeUntilByte2<Input> where
    <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
    Input: Stream,
    Input: RangeStream,
    Input::Range: AsRef<[u8]> + Range
Expand description

Zero-copy parser which reads a range of 0 or more tokens until a or b is found.

If a or b is not found, the parser will return an error.

let mut parser = take_until_byte2(b'\r', b'\n');
let result = parser.parse("To: user@example.com\r\n");
assert_eq!(result, Ok(("To: user@example.com", "\r\n")));
let result = parser.parse("Hello, world\n");
assert_eq!(result, Ok(("Hello, world", "\n")));