Parse

Struct Parse 

Source
pub struct Parse;
Expand description

Parser mode that extracts output or an error from the parser’s input

Trait Implementations§

Source§

impl Mode for Parse

Source§

type OutputForm<O> = O

The representational form of a successful parser application in this mode
Source§

type ErrorForm<E> = E

The representational form of a failed parser application in this mode
Source§

type MessageContainer<M> = ()

The representational form of stored messages used by this mode
Source§

fn apply_parser<'a, O, E, M, I, P>( parser: &P, input: &'a I, ) -> ModeResult<O, E, M, Parse>
where I: Input<'a>, P: Parser<'a, O, E, M, I> + ?Sized,

Applies a parser using this Mode
Source§

fn convert_output<O>(output: impl Into<O>) -> O

Converts an output to its representational form in this mode
Source§

fn convert_error<E>(error: impl Into<E>) -> E

Converts an error to its representational form in this mode
Source§

fn merge_outputs<OA1, OA2, OB>( output_1: OA1, output_2: OA2, function: impl Fn(OA1, OA2) -> OB, ) -> OB

Merges two output types into one using a function
Source§

fn merge_errors<EA1, EA2, EB>( error_1: EA1, error_2: EA2, function: impl Fn(EA1, EA2) -> EB, ) -> EB

Merges two error types into one using a function
Source§

fn merge_message_containers<M>(_: (), _: impl Into<()>)

Combine two Self::MessageContainers
Source§

fn map_output<OA, OB, E, M>( result: ModeResult<OA, E, M, Parse>, function: impl Fn(OA) -> OB, ) -> ModeResult<OB, E, M, Parse>

Maps a result’s output type to another type in this mode
Source§

fn map_error<O, EA, EB, M>( result: ModeResult<O, EA, M, Parse>, function: impl Fn(EA) -> EB, ) -> ModeResult<O, EB, M, Parse>

Maps a result’s error type to another type in this mode
Source§

fn map_messages<O, E, MA, MB>( result: ModeResult<O, E, MA, Parse>, _: impl Fn(MA) -> MB, ) -> ModeResult<O, E, MB, Parse>

Maps a result’s message type to another type in this mode
Source§

fn new_message_container<M>()

Create a new empty Self::MessageContainer
Source§

fn add_message_to_container<M>( _: &mut <Parse as Mode>::MessageContainer<M>, _: M, )

Adds a message to a Self::MessageContainer

Auto Trait Implementations§

§

impl Freeze for Parse

§

impl RefUnwindSafe for Parse

§

impl Send for Parse

§

impl Sync for Parse

§

impl Unpin for Parse

§

impl UnwindSafe for Parse

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.