Trait Parser

Source
pub trait Parser<T = Node> {
    // Required method
    fn parse(&self, state: &mut State) -> T;

    // Provided methods
    fn map<F>(self, f: F) -> Map<Self, F, T>
       where Self: Sized { ... }
    fn boxed<'a>(self) -> Box<dyn Parser<T> + 'a>
       where Self: 'a + Sized { ... }
    fn arc<'a>(self) -> Arc<dyn Parser<T> + 'a>
       where Self: 'a + Sized { ... }
}

Required Methods§

Source

fn parse(&self, state: &mut State) -> T

Provided Methods§

Source

fn map<F>(self, f: F) -> Map<Self, F, T>
where Self: Sized,

Source

fn boxed<'a>(self) -> Box<dyn Parser<T> + 'a>
where Self: 'a + Sized,

Source

fn arc<'a>(self) -> Arc<dyn Parser<T> + 'a>
where Self: 'a + Sized,

Implementations on Foreign Types§

Source§

impl Parser for &'static str

Source§

fn parse(&self, state: &mut State) -> Node

Source§

impl Parser<Span> for &'static str

Source§

fn parse(&self, state: &mut State) -> Span

Implementors§

Source§

impl<F, T> Parser<T> for F
where F: Fn(&mut State) -> T,

Source§

impl<P> Parser for AsExtra<P>
where P: Parser<Node>,

Source§

impl<P: Parser> Parser for WithExtra<P>

Source§

impl<T, O, P, F> Parser<O> for Map<P, F, T>
where P: Parser<T>, F: Fn(T) -> O,