pub type BoxedParser<'a, A, S> = Box<dyn FnMut(&'a str, Location, S) -> ParseResult<'a, A, S> + 'a>;Aliased Type§
pub struct BoxedParser<'a, A, S>(/* private fields */);Trait Implementations§
Source§impl<'a, A, S: Clone + 'a> Parser<'a> for BoxedParser<'a, A, S>
impl<'a, A, S: Clone + 'a> Parser<'a> for BoxedParser<'a, A, S>
type Output = A
type State = S
Source§fn parse(
&mut self,
input: &'a str,
location: Location,
state: S,
) -> ParseResult<'a, A, S>
fn parse( &mut self, input: &'a str, location: Location, state: S, ) -> ParseResult<'a, A, S>
Parse a given input, starting at
a given location and state.
Source§fn run(
&mut self,
input: &'a str,
state: Self::State,
) -> ParseResult<'a, Self::Output, Self::State>
fn run( &mut self, input: &'a str, state: Self::State, ) -> ParseResult<'a, Self::Output, Self::State>
Run the parser on a given input, starting at
the first character. Read more
Source§fn map<F, NewOutput: 'a>(self, map_fn: F) -> Map<Self, F>
fn map<F, NewOutput: 'a>(self, map_fn: F) -> Map<Self, F>
Map the output to a new output if parse succeeds.
Otherwise, return error as usual. Read more
Source§fn map_with_state<F, NewOutput: 'a>(self, map_fn: F) -> MapWithState<Self, F>
fn map_with_state<F, NewOutput: 'a>(self, map_fn: F) -> MapWithState<Self, F>
The map function is supplied both the output and the
state of the parser.
Otherwise, return error as usual. Read more
Source§fn map_err<F>(self, map_fn: F) -> MapErr<Self, F>
fn map_err<F>(self, map_fn: F) -> MapErr<Self, F>
Map the error message to a new message if parse fails.
Otherwise, return output as usual. Read more
Source§fn and_then<F, P2, B>(self, f: F) -> AndThen<Self, F>
fn and_then<F, P2, B>(self, f: F) -> AndThen<Self, F>
Returns a new parser which is given the current output if parse succeeds.
Otherwise, return error as usual. Read more
Source§fn pred<F>(self, predicate: F, expecting: &'a str) -> Pred<'_, Self, F>
fn pred<F>(self, predicate: F, expecting: &'a str) -> Pred<'_, Self, F>
Judge if the output meets the requirement using a predicate function
if the parse succeeds. Otherwise, return error as usual.
Source§fn ignore(self) -> Ignore<Self>where
Self: Sized + 'a,
fn ignore(self) -> Ignore<Self>where
Self: Sized + 'a,
Ignore the parse output and return
() (emtpy tuple)Source§fn update_state<F>(self, f: F) -> UpdateState<Self, F>
fn update_state<F>(self, f: F) -> UpdateState<Self, F>
Update the state given the new output and state of the parse if parse succeeds.
Otherwise, return error as usual.
Source§fn update<B, F>(self, f: F) -> Update<Self, F>
fn update<B, F>(self, f: F) -> Update<Self, F>
Update the result of the parser if parse succeeds.
Otherwise, return error as usual. Read more
Source§fn end(self) -> End<Self>where
Self: Sized + 'a,
fn end(self) -> End<Self>where
Self: Sized + 'a,
Check if you have reached the end of the input you are parsing. Read more
Source§fn keep<A, B, P2>(self, arg_parser: P2) -> Keep<Self, P2>
fn keep<A, B, P2>(self, arg_parser: P2) -> Keep<Self, P2>
Keep values in a parser pipeline. Read more
Source§fn skip<P2>(self, ignored_parser: P2) -> Skip<Self, P2>
fn skip<P2>(self, ignored_parser: P2) -> Skip<Self, P2>
Skip values in a parser pipeline. Read more