Function combine::parser::combinator::any_partial_state [] [src]

pub fn any_partial_state<P>(p: P) -> AnyPartialStateParser<P> where
    P: Parser,
    P::PartialState: 'static, 

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[I]()(I) -> (char, char)
    where [ I: Stream<Item = char> ]
    {
        any_partial_state((letter(), letter()))
    }
}

assert_eq!(
    example().easy_parse("ab"),
    Ok((('a', 'b'), ""))
);