Function glue::combinators::structures::delimited

source ยท
pub fn delimited<'a, Lhs, LhsRes, Par, ParRes, Rhs, RhsRes>(
    prefix: Lhs,
    parser: Par,
    suffix: Rhs,
) -> impl Parser<'a, ParRes>
where Lhs: Parser<'a, LhsRes>, Par: Parser<'a, ParRes>, Rhs: Parser<'a, RhsRes>,
Expand description

Match a structure with left and right hand delimiters.

assert_eq!(
    delimited(is('['), take(1..3, is(any)), is(']')).parse("[123]"),
    Ok((
        ParserContext {
            input: "[123]",
            bounds: 4..5,
        },
        "123"
    ))
);