oni_comb_parser_rs::prelude

Trait Parsers

Source
pub trait Parsers {
    type P<'p, I, A>: ParserMonad<'p, Input = I, Output = A>
       where I: 'p,
             A: 'p;

    // Required methods
    fn parse<'a, 'b, I, A>(
        parser: &Self::P<'a, I, A>,
        input: &'b [I],
    ) -> Result<A, ParseError<'a, I>>
       where A: 'a,
             'b: 'a;
    fn successful<'a, I, A>(value: A) -> Self::P<'a, I, A>
       where A: Clone + 'a;
    fn successful_lazy<'a, I, A, F>(value: F) -> Self::P<'a, I, A>
       where F: Fn() -> A + 'a,
             A: 'a;
    fn failed<'a, I, A>(
        value: ParseError<'a, I>,
        committed: CommittedStatus,
    ) -> Self::P<'a, I, A>
       where I: Clone + 'a,
             A: 'a;
    fn failed_lazy<'a, I, A, F>(f: F) -> Self::P<'a, I, A>
       where F: Fn() -> (ParseError<'a, I>, CommittedStatus) + 'a,
             I: 'a,
             A: 'a;
    fn filter<'a, I, A, F>(parser: Self::P<'a, I, A>, f: F) -> Self::P<'a, I, A>
       where F: Fn(&A) -> bool + 'a,
             I: 'a,
             A: 'a;
    fn flat_map<'a, I, A, B, F>(
        parser: Self::P<'a, I, A>,
        f: F,
    ) -> Self::P<'a, I, B>
       where F: Fn(A) -> Self::P<'a, I, B> + 'a,
             A: 'a,
             B: 'a;
    fn map<'a, I, A, B, F>(parser: Self::P<'a, I, A>, f: F) -> Self::P<'a, I, B>
       where F: Fn(A) -> B + 'a,
             A: 'a,
             B: Clone + 'a;

    // Provided method
    fn unit<'a, I>() -> Self::P<'a, I, ()> { ... }
}

Required Associated Types§

Source

type P<'p, I, A>: ParserMonad<'p, Input = I, Output = A> where I: 'p, A: 'p

Required Methods§

Source

fn parse<'a, 'b, I, A>( parser: &Self::P<'a, I, A>, input: &'b [I], ) -> Result<A, ParseError<'a, I>>
where A: 'a, 'b: 'a,

Source

fn successful<'a, I, A>(value: A) -> Self::P<'a, I, A>
where A: Clone + 'a,

Source

fn successful_lazy<'a, I, A, F>(value: F) -> Self::P<'a, I, A>
where F: Fn() -> A + 'a, A: 'a,

Source

fn failed<'a, I, A>( value: ParseError<'a, I>, committed: CommittedStatus, ) -> Self::P<'a, I, A>
where I: Clone + 'a, A: 'a,

Source

fn failed_lazy<'a, I, A, F>(f: F) -> Self::P<'a, I, A>
where F: Fn() -> (ParseError<'a, I>, CommittedStatus) + 'a, I: 'a, A: 'a,

Source

fn filter<'a, I, A, F>(parser: Self::P<'a, I, A>, f: F) -> Self::P<'a, I, A>
where F: Fn(&A) -> bool + 'a, I: 'a, A: 'a,

Source

fn flat_map<'a, I, A, B, F>( parser: Self::P<'a, I, A>, f: F, ) -> Self::P<'a, I, B>
where F: Fn(A) -> Self::P<'a, I, B> + 'a, A: 'a, B: 'a,

Source

fn map<'a, I, A, B, F>(parser: Self::P<'a, I, A>, f: F) -> Self::P<'a, I, B>
where F: Fn(A) -> B + 'a, A: 'a, B: Clone + 'a,

Provided Methods§

Source

fn unit<'a, I>() -> Self::P<'a, I, ()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§