pub trait ChoiceParser<Input: Stream> {
type Output;
type PartialState: Default;
// Required methods
fn parse_first(
&mut self,
input: &mut Input,
state: &mut Self::PartialState,
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>;
fn parse_partial(
&mut self,
input: &mut Input,
state: &mut Self::PartialState,
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>;
fn parse_mode_choice<M>(
&mut self,
mode: M,
input: &mut Input,
state: &mut Self::PartialState,
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
where M: ParseMode,
Self: Sized;
fn add_error_choice(
&mut self,
error: &mut Tracked<<Input as StreamOnce>::Error>,
);
}Expand description
ChoiceParser represents a parser which may parse one of several different choices depending
on the input.
This is an internal trait used to overload the choice function.
Required Associated Types§
type Output
type PartialState: Default
Required Methods§
fn parse_first( &mut self, input: &mut Input, state: &mut Self::PartialState, ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_partial( &mut self, input: &mut Input, state: &mut Self::PartialState, ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_mode_choice<M>(
&mut self,
mode: M,
input: &mut Input,
state: &mut Self::PartialState,
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>where
M: ParseMode,
Self: Sized,
fn add_error_choice( &mut self, error: &mut Tracked<<Input as StreamOnce>::Error>, )
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".