Function glue::combinators::takers::take

source ยท
pub fn take<'a, Skip, Par, Rep>(
    range: Rep,
    callback: Par,
) -> impl Parser<'a, &'a str>
where Par: Parser<'a, Skip>, Rep: RangeBounds<usize>,
Expand description

Run a parser a minimum number of times and up to a maximum and capture the input it parsed.

assert_eq!(
    take(1..2, is("foo")).parse("foofoobar"),
    Ok((
        ParserContext {
            input: "foofoobar",
            bounds: 0..6,
        },
        "foofoo"
    ))
);