Function rocket::mtls::oid::asn1_rs::nom::combinator::peek

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

Tries to apply its parser without consuming the input.

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

let mut parser = peek(alpha1);

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