pub trait Parser<I: TimeTravel> {
type Output;
Show 19 methods
// Required method
fn parse(&self, input: I) -> Option<Self::Output>;
// Provided methods
fn map<U, F>(self, f: F) -> Map<Self, I, F>
where Self: Sized,
F: FnMut(Self::Output) -> U { ... }
fn and<B>(self, b: B) -> And<Self, B, I>
where Self: Sized,
B: Parser<I> { ... }
fn or<B>(self, b: B) -> Or<Self, B, I>
where Self: Sized,
B: Parser<I, Output = Self::Output> { ... }
fn not(self) -> Not<Self, I>
where Self: Sized { ... }
fn many(self) -> Many<Self, I>
where Self: Sized { ... }
fn many1(self) -> Many<Self, I>
where Self: Sized { ... }
fn many_min(self, min: usize) -> Many<Self, I>
where Self: Sized { ... }
fn many_max(self, max: usize) -> Many<Self, I>
where Self: Sized { ... }
fn many1_max(self, max: usize) -> Many<Self, I>
where Self: Sized { ... }
fn many_min_max(self, min: usize, max: usize) -> Many<Self, I>
where Self: Sized { ... }
fn some(self, count: usize) -> Many<Self, I>
where Self: Sized { ... }
fn may(self) -> May<Self, I>
where Self: Sized { ... }
fn iter(self) -> Iter<Self, I>
where Self: Sized { ... }
fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>
where Self: Sized,
U: Parser<I>,
F: FnMut(Self::Output) -> U { ... }
fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>
where Self: Sized,
U: Parser<I, Output = Self::Output>,
F: FnMut() -> U { ... }
fn or_trans<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
where Self: Sized,
F: FnMut(I, Range<usize>) -> Self::Output { ... }
fn or_trans_noend<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
where Self: Sized,
F: FnMut(I, Range<usize>) -> Self::Output { ... }
fn dyns(self) -> Dyn<I, Self::Output>
where Self: Sized + 'static { ... }
}Expand description
Abstract Parser with chain call
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn map<U, F>(self, f: F) -> Map<Self, I, F>
fn map<U, F>(self, f: F) -> Map<Self, I, F>
Map a Parser<Output = T> to Parser<Output = U> by applying a function to a contained value
Sourcefn many_min_max(self, min: usize, max: usize) -> Many<Self, I>where
Self: Sized,
fn many_min_max(self, min: usize, max: usize) -> Many<Self, I>where
Self: Sized,
{n,m}, >= n && <= m
Sourcefn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>
fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>
Fail if the subparser fail, otherwise calls f with the new Parser and parse the Parser
Sourcefn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>
fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>
Pass if subparser pass, otherwise calls f and parse the result Parser
Sourcefn or_trans<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
fn or_trans<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
Pass if subparser pass, otherwise calls f with error point
no_retryStop immediately without trying to get the error range
Sourcefn or_trans_noend<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
fn or_trans_noend<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
Pass if subparser pass, otherwise calls f with error point, but ignore EOF
no_retryStop immediately without trying to get the error range