Function nom::combinator::cut[][src]

pub fn cut<I: Clone + Slice<RangeTo<usize>>, O, E: ParseError<I>, F>(
    parser: F
) -> impl Fn(I) -> IResult<I, O, E> where
    F: Fn(I) -> IResult<I, O, E>, 

transforms an error to failure

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

let parser = cut(alpha1);

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