Function utils::parser::eol

source ·
pub fn eol() -> Eol
Expand description

Parser which matches newlines or the end of the input.

Matches both LF and CRLF line endings.

§Examples

assert_eq!(
    parser::eol().parse(b"\nabc"),
    Ok(((), &b"abc"[..]))
);
assert_eq!(
    parser::eol().parse(b"\r\nabc"),
    Ok(((), &b"abc"[..]))
);
assert_eq!(
    parser::eol().parse(b""),
    Ok(((), &b""[..]))
);