pub fn take_until_range<I>(r: I::Range) -> TakeUntilRange<I>where
I: 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 consumed. 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());