Struct lip::BoxedParser [−][src]
pub struct BoxedParser<'a, Output, State> { /* fields omitted */ }
Expand description
Box Parser
trait so its size is decidable in compile time.
Essentially allocate the Parser
on the heap in runtime.
Makes passing Parser
around much easier because types that impl trait
may be different under the hood while BoxedParser
is always a pointer
to a place in the heap.
Implementations
Trait Implementations
impl<'a, Output, State> Parser<'a, Output, State> for BoxedParser<'a, Output, State> where
State: Clone,
impl<'a, Output, State> Parser<'a, Output, State> for BoxedParser<'a, Output, State> where
State: Clone,
fn parse(
&self,
input: &'a str,
location: Location,
state: State
) -> ParseResult<'a, Output, State>
fn parse(
&self,
input: &'a str,
location: Location,
state: State
) -> ParseResult<'a, Output, State>
Parse a given input, starting at a given location and state. Read more
Run the parser on a given input, starting at the first character. Read more
fn map<F, NewOutput>(self, map_fn: F) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
F: Fn(Output) -> NewOutput + 'a,
fn map<F, NewOutput>(self, map_fn: F) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
F: Fn(Output) -> NewOutput + 'a,
Map the output to a new output if parse succeeds. Otherwise, return error as usual. Read more
fn map_with_state<F, NewOutput>(
self,
map_fn: F
) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
F: Fn(Output, State) -> NewOutput + 'a,
fn map_with_state<F, NewOutput>(
self,
map_fn: F
) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
F: Fn(Output, State) -> NewOutput + 'a,
The map function is supplied both the output and the state of the parser. Otherwise, return error as usual. Read more
Map the error message to a new message if parse fails. Otherwise, return output as usual. Read more
Returns a new parser which is given the current output if parse succeeds. Otherwise, return error as usual. Read more
Judge if the output meets the requirement using a predicate function if the parse succeeds. Otherwise, return error as usual. Read more
Ignore the parse output and return ()
(emtpy tuple)
fn update_state<F>(self, f: F) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
State: 'a,
Output: Clone + 'a,
F: Fn(Output, State) -> State + 'a,
fn update_state<F>(self, f: F) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
State: 'a,
Output: Clone + 'a,
F: Fn(Output, State) -> State + 'a,
Update the state given the new output and state of the parse if parse succeeds. Otherwise, return error as usual. Read more
fn update<F, NewOutput>(self, f: F) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
State: 'a,
Output: Clone + 'a,
NewOutput: Clone + 'a,
F: Fn(&'a str, Output, Location, State) -> ParseResult<'a, NewOutput, State> + 'a,
fn update<F, NewOutput>(self, f: F) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
State: 'a,
Output: Clone + 'a,
NewOutput: Clone + 'a,
F: Fn(&'a str, Output, Location, State) -> ParseResult<'a, NewOutput, State> + 'a,
Update the result of the parser if parse succeeds. Otherwise, return error as usual. Read more
fn end(self) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: Clone + 'a,
State: 'a,
fn end(self) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: Clone + 'a,
State: 'a,
Check if you have reached the end of the input you are parsing. Read more
Keep values in a parser pipeline. Read more
Auto Trait Implementations
impl<'a, Output, State> !RefUnwindSafe for BoxedParser<'a, Output, State>
impl<'a, Output, State> !Send for BoxedParser<'a, Output, State>
impl<'a, Output, State> !Sync for BoxedParser<'a, Output, State>
impl<'a, Output, State> Unpin for BoxedParser<'a, Output, State>
impl<'a, Output, State> !UnwindSafe for BoxedParser<'a, Output, State>
Blanket Implementations
Mutably borrows from an owned value. Read more