Function nom::combinator::cut
source · [−]pub fn cut<I, O, E: ParseError<I>, F>(
parser: F
) -> impl FnMut(I) -> IResult<I, O, E> where
F: Parser<I, O, E>,
Expand description
transforms an error to failure
use nom::combinator::cut;
use nom::character::complete::alpha1;
let mut parser = cut(alpha1);
assert_eq!(parser("abcd;"), Ok((";", "abcd")));
assert_eq!(parser("123;"), Err(Err::Failure(("123;", ErrorKind::Alpha))));