pub fn map_parser<I, O1, O2, E: ParseError<I>, F, G>(
    parser: F,
    applied_parser: G
) -> impl FnMut(I) -> IResult<I, O2, E> where
    F: Parser<I, O1, E>,
    G: Parser<O1, O2, E>, 
Expand description

Applies a parser over the result of another one.

use nom::character::complete::digit1;
use nom::bytes::complete::take;
use nom::combinator::map_parser;

let mut parse = map_parser(take(5u8), digit1);

assert_eq!(parse("12345"), Ok(("", "12345")));
assert_eq!(parse("123ab"), Ok(("", "123")));
assert_eq!(parse("123"), Err(Err::Error(("123", ErrorKind::Eof))));