pub fn peek<I, O, E, F>(f: F) -> impl FnMut(I)
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))));