Function combine::parser::combinator::any_send_sync_partial_state [−][src]
pub fn any_send_sync_partial_state<Input, P>(
p: P
) -> AnySendSyncPartialStateParser<P> where
Input: Stream,
P: Parser<Input>,
P::PartialState: Send + Sync + '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.
fn example<Input>() -> impl Parser<Input, Output = (char, char), PartialState = AnySendSyncPartialState> where Input: Stream<Token = char>, Input::Error: ParseError<Input::Token, Input::Range, Input::Position>, { any_send_sync_partial_state((letter(), letter())) } assert_eq!( example().easy_parse("ab"), Ok((('a', 'b'), "")) );