Function rocket::mtls::oid::asn1_rs::nom::character::complete::newline

source ·
pub fn newline<I, Error>(input: I) -> Result<(I, char), Err<Error>>
where Error: ParseError<I>, I: Slice<RangeFrom<usize>> + InputIter, <I as InputIter>::Item: AsChar,
Available on crate feature mtls only.
Expand description

Matches a newline character ‘\n’.

Complete version: Will return an error if there’s not enough input data.

§Example

fn parser(input: &str) -> IResult<&str, char> {
    newline(input)
}

assert_eq!(parser("\nc"), Ok(("c", '\n')));
assert_eq!(parser("\r\nc"), Err(Err::Error(Error::new("\r\nc", ErrorKind::Char))));
assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char))));