pub trait Parser<'a, 'b>: Debug {
type Error: Error<'a, 'b>;
type Output;
type Requirement: Debug + Display;
type RequirementContext;
fn parse(
&self,
src: &'b str,
pos: &mut usize
) -> Result<Self::Output, Self::Error>;
fn requirement(
&self,
context: Option<&Self::RequirementContext>
) -> Self::Requirement;
fn skip(&self, src: &'b str, pos: &mut usize) -> Option<Self::Error> { ... }
fn and_then<P>(self, next: P) -> SequenceParser<'a, 'b, Self, P>
where
Self: Sized,
P: Parser<'a, 'b>,
{ ... }
fn or<P>(self, next: P) -> OrderParser<'a, 'b, Self, P>
where
Self: Sized,
P: Parser<'a, 'b>,
{ ... }
fn map<F, P>(self, mapper: F) -> MapParser<'a, 'b, Self, F, P>
where
Self: Sized,
F: 'static + Fn(Self::Output) -> P,
P: 'b,
{ ... }
fn and_gen<F, P>(self, generator: F) -> GenParser<'a, 'b, Self, F, P>
where
Self: Sized,
F: 'static + Fn(&Self::Output) -> P,
P: Parser<'a, 'b>,
{ ... }
fn repeat(self, min: usize, max: usize) -> RepetitionParser<'a, 'b, Self>
where
Self: Sized,
{ ... }
fn zero_or_more(self) -> RepetitionParser<'a, 'b, Self>
where
Self: Sized,
{ ... }
fn one_or_more(self) -> RepetitionParser<'a, 'b, Self>
where
Self: Sized,
{ ... }
fn stringify(self) -> StringifyParser<'a, 'b, Self>
where
Self: Sized,
{ ... }
}