rocket::mtls::x509::der_parser::asn1_rs::nom::combinator

Function all_consuming

Source
pub fn all_consuming<I, O, E, F>(f: F) -> impl FnMut(I)
where E: ParseError<I>, I: InputLength, F: Parser<I, O, E>,
Available on crate feature mtls only.
Expand description

Succeeds if all the input has been consumed by its child parser.

use nom::combinator::all_consuming;
use nom::character::complete::alpha1;

let mut parser = all_consuming(alpha1);

assert_eq!(parser("abcd"), Ok(("", "abcd")));
assert_eq!(parser("abcd;"),Err(Err::Error((";", ErrorKind::Eof))));
assert_eq!(parser("123abcd;"),Err(Err::Error(("123abcd;", ErrorKind::Alpha))));