Function combine::parser::sequence::between[][src]

pub fn between<Input, L, R, P>(
    open: L,
    close: R,
    parser: P
) -> Between<Input, L, R, P> where
    <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
    Input: Stream,
    Input: Stream,
    L: Parser<Input>,
    R: Parser<Input>,
    P: Parser<Input>, 
Expand description

Parses open followed by parser followed by close. Returns the value of parser.

let result = between(token('['), token(']'), string("rust"))
    .parse("[rust]")
    .map(|x| x.0);
assert_eq!(result, Ok("rust"));