[−][src]Struct lip::BoxedParser
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.
Methods
impl<'a, Output, State> BoxedParser<'a, Output, State>[src]
pub fn new<P>(parser: P) -> Self where
P: Parser<'a, Output, State> + 'a,
State: Clone, [src]
P: Parser<'a, Output, State> + 'a,
State: Clone,
Box any type that implements the Parser trait
Trait Implementations
impl<'a, Output, State> Parser<'a, Output, State> for BoxedParser<'a, Output, State> where
State: Clone, [src]
State: Clone,
fn parse(
&self,
input: &'a str,
location: Location,
state: State
) -> ParseResult<'a, Output, State>[src]
&self,
input: &'a str,
location: Location,
state: State
) -> ParseResult<'a, Output, State>
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, [src]
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
F: Fn(Output) -> 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, [src]
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_err<F>(self, map_fn: F) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: 'a,
State: 'a,
F: Fn(String) -> String + 'a, [src]
Self: Sized + 'a,
Output: 'a,
State: 'a,
F: Fn(String) -> String + 'a,
fn and_then<F, NextParser, NewOutput>(
self,
f: F
) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
NextParser: Parser<'a, NewOutput, State> + 'a,
F: Fn(Output) -> NextParser + 'a, [src]
self,
f: F
) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
NextParser: Parser<'a, NewOutput, State> + 'a,
F: Fn(Output) -> NextParser + 'a,
fn pred<F>(
self,
predicate: F,
expecting: &'a str
) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: Display + 'a,
State: 'a,
F: Fn(&Output) -> bool + 'a, [src]
self,
predicate: F,
expecting: &'a str
) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: Display + 'a,
State: 'a,
F: Fn(&Output) -> bool + 'a,
fn ignore(self) -> BoxedParser<'a, (), State> where
Self: Sized + 'a,
Output: 'a,
State: 'a, [src]
Self: Sized + 'a,
Output: 'a,
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, [src]
Self: Sized + 'a,
State: 'a,
Output: Clone + 'a,
F: Fn(Output, State) -> State + 'a,
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
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<'a, F, Output, State> Parser<'a, Output, State> for F where
F: Fn(&'a str, Location, State) -> ParseResult<'a, Output, State>,
State: 'a + Clone, [src]
F: Fn(&'a str, Location, State) -> ParseResult<'a, Output, State>,
State: 'a + Clone,
fn parse(&Self, &'a str, Location, State) -> ParseResult<'a, Output, State>[src]
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, [src]
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
F: Fn(Output) -> 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, [src]
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_err<F>(self, map_fn: F) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: 'a,
State: 'a,
F: Fn(String) -> String + 'a, [src]
Self: Sized + 'a,
Output: 'a,
State: 'a,
F: Fn(String) -> String + 'a,
fn and_then<F, NextParser, NewOutput>(
self,
f: F
) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
NextParser: Parser<'a, NewOutput, State> + 'a,
F: Fn(Output) -> NextParser + 'a, [src]
self,
f: F
) -> BoxedParser<'a, NewOutput, State> where
Self: Sized + 'a,
Output: 'a,
NewOutput: 'a,
State: 'a,
NextParser: Parser<'a, NewOutput, State> + 'a,
F: Fn(Output) -> NextParser + 'a,
fn pred<F>(
self,
predicate: F,
expecting: &'a str
) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: Display + 'a,
State: 'a,
F: Fn(&Output) -> bool + 'a, [src]
self,
predicate: F,
expecting: &'a str
) -> BoxedParser<'a, Output, State> where
Self: Sized + 'a,
Output: Display + 'a,
State: 'a,
F: Fn(&Output) -> bool + 'a,
fn ignore(self) -> BoxedParser<'a, (), State> where
Self: Sized + 'a,
Output: 'a,
State: 'a, [src]
Self: Sized + 'a,
Output: 'a,
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, [src]
Self: Sized + 'a,
State: 'a,
Output: Clone + 'a,
F: Fn(Output, State) -> State + 'a,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,