Function nom::combinator::peek [−][src]
pub fn peek<I: Clone, O, E: ParseError<I>, F>(
f: F
) -> impl Fn(I) -> IResult<I, O, E> where
F: Fn(I) -> IResult<I, O, E>,
tries to apply its parser without consuming the input
use nom::combinator::peek; use nom::character::complete::alpha1; let parser = peek(alpha1); assert_eq!(parser("abcd;"), Ok(("abcd;", "abcd"))); assert_eq!(parser("123;"), Err(Err::Error(("123;", ErrorKind::Alpha))));