Function combine::byte::take_until_byte [] [src]

pub fn take_until_byte<I>(a: u8) -> TakeUntilByte<I> where
    I: RangeStream + FullRangeStream,
    I::Range: AsRef<[u8]>, 

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

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

let mut parser = take_until_byte(b'\r');
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!(result.is_err());