Function consumed
fn consumed<I, F, E>(parser: F) -> impl Parser<I, Output = (I, <F as Parser<I>>::Output), Error = E>
where
I: Clone + Offset + Input,
E: ParseError<I>,
F: Parser<I, Error = E>
if the child parser was successful, return the consumed input with the output as a tuple. Functions similarly to recognize except it returns the parser output as well.
This can be useful especially in cases where the output is not the same type as the input, or the input is a user defined type.
Returned tuple is of the format (consumed input, produced output).
# use ;
use ;
use ;
use tag;
use separated_pair;
#