Function combine::parser::combinator::any_partial_state [−][src]
pub fn any_partial_state<Input, P>(p: P) -> AnyPartialStateParser<P> where
Input: Stream,
P: Parser<Input>,
P::PartialState: 'static,
Expand description
Returns a parser where P::PartialState
is boxed. Useful as a way to avoid writing the type
since it can get very large after combining a few parsers.
parser! { type PartialState = AnyPartialState; fn example[Input]()(Input) -> (char, char) where [ Input: Stream<Token = char> ] { any_partial_state((letter(), letter())) } } assert_eq!( example().easy_parse("ab"), Ok((('a', 'b'), "")) );