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

Function anychar

Source
pub fn anychar<T, E>(input: T) -> Result<(T, char), Err<E>>
Available on crate feature mtls only.
Expand description

Matches one byte as a character. Note that the input type will accept a str, but not a &[u8], unlike many other nom parsers.

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

§Example

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

assert_eq!(parser("abc"), Ok(("bc",'a')));
assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Eof))));