combine::parser::byte

Function crlf

Source
pub fn crlf<I>() -> CrLf<I>
where I: Stream<Item = u8>, I::Error: ParseError<I::Item, I::Range, I::Position>,
Expand description

Parses carriage return and newline (&b"\r\n"), returning the newline byte.

use combine::Parser;
use combine::parser::byte::crlf;
assert_eq!(crlf().parse(&b"\r\n"[..]), Ok((b'\n', &b""[..])));
assert!(crlf().parse(&b"\r"[..]).is_err());
assert!(crlf().parse(&b"\n"[..]).is_err());