pub fn take_until_range<Input>(r: Input::Range) -> TakeUntilRange<Input> where
Input: RangeStream,
Expand description
Zero-copy parser which reads a range of 0 or more tokens until r
is found.
The range r
will not be committed. If r
is not found, the parser will
return an error.
repeat::take_until
is a non-RangeStream
alternative.
let mut parser = take_until_range("\r\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!(result.is_err());