Function winnow::combinator::map_parser
source · 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>,👎Deprecated since 0.1.0: Replaced with `Parser::and_then
Expand description
Applies a parser over the result of another one.
WARNING: Deprecated, replaced with Parser::and_then
use winnow::character::digit1;
use winnow::bytes::take;
use winnow::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(ErrMode::Backtrack(Error::new("123", ErrorKind::Eof))));