Function glue::combinators::takers::take_any

source ยท
pub fn take_any<'a, Res, Par>(parser: Par) -> impl Parser<'a, &'a str>
where Par: BranchParser<'a, Res>,
Expand description

Run each of the provided parsers until one is successful and return the input it parsed.

assert_eq!(
    take_any((is("foo"), is("bar"))).parse("bar"),
    Ok((
        ParserContext {
            input: "bar",
            bounds: 0..3,
        },
        "bar"
    ))
);

Each parser that is passed to take_any must return the same type as the parser only has a single output type.