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 + 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"));