Function glue::combinators::mappers::map_result
source ยท pub fn map_result<'a, OldRes, NewRes, Par, Map>(
parser: Par,
mapper: Map,
) -> impl Parser<'a, NewRes>Expand description
Run a parser and map the data it returns on success.
assert_eq!(
map_result(take(1.., is(numeric)), |num: &str| num
.parse::<usize>()
.unwrap())
.parse("123"),
Ok((
ParserContext {
input: "123",
bounds: 0..3,
},
123
))
);