Trait astray::Parsable

source ·
pub trait Parsable<TToken>: Debug + Sizedwhere
    TToken: Parsable<TToken> + ConsumableToken,{
    type ApplyMatchTo: Parsable<TToken> = Self;

    // Required method
    fn parse(iter: &mut TokenIter<TToken>) -> Result<Self, ParseError<TToken>>;

    // Provided methods
    fn parse_if_match<F>(
        iter: &mut TokenIter<TToken>,
        matches: F,
        pattern: Option<&'static str>
    ) -> Result<Self, ParseError<TToken>>
       where F: Fn(&Self::ApplyMatchTo) -> bool,
             Self: Sized { ... }
    fn identifier() -> &'static str { ... }
}

Provided Associated Types§

source

type ApplyMatchTo: Parsable<TToken> = Self

Required Methods§

source

fn parse(iter: &mut TokenIter<TToken>) -> Result<Self, ParseError<TToken>>

Provided Methods§

source

fn parse_if_match<F>( iter: &mut TokenIter<TToken>, matches: F, pattern: Option<&'static str> ) -> Result<Self, ParseError<TToken>>where F: Fn(&Self::ApplyMatchTo) -> bool, Self: Sized,

source

fn identifier() -> &'static str

Implementations on Foreign Types§

source§

impl<T, P> Parsable<T> for Option<P>where P: Parsable<T, ApplyMatchTo = P>, T: ConsumableToken,

§

type ApplyMatchTo = P

source§

fn parse(iter: &mut TokenIter<T>) -> Result<Option<P>, ParseError<T>>

source§

fn parse_if_match<F>( iter: &mut TokenIter<T>, matches: F, pattern: Option<&'static str> ) -> Result<Option<P>, ParseError<T>>where F: Fn(&<Option<P> as Parsable<T>>::ApplyMatchTo) -> bool, Option<P>: Sized,

source§

impl<P1, P2, P3, T> Parsable<T> for (P1, P2, P3)where P1: Parsable<T>, P2: Parsable<T>, P3: Parsable<T>, T: ConsumableToken,

source§

fn parse(iter: &mut TokenIter<T>) -> Result<(P1, P2, P3), ParseError<T>>where (P1, P2, P3): Sized,

source§

fn parse_if_match<F>( iter: &mut TokenIter<T>, matches: F, pattern: Option<&'static str> ) -> Result<(P1, P2, P3), ParseError<T>>where F: Fn(&(P1, P2, P3)) -> bool, (P1, P2, P3): Sized,

source§

impl<P1, P2, T> Parsable<T> for (P1, P2)where P1: Parsable<T>, P2: Parsable<T>, T: ConsumableToken,

source§

fn parse(iter: &mut TokenIter<T>) -> Result<(P1, P2), ParseError<T>>where (P1, P2): Sized,

source§

fn parse_if_match<F>( iter: &mut TokenIter<T>, matches: F, pattern: Option<&'static str> ) -> Result<(P1, P2), ParseError<T>>where F: Fn(&<(P1, P2) as Parsable<T>>::ApplyMatchTo) -> bool, (P1, P2): Sized,

source§

impl<T, P> Parsable<T> for Box<P, Global>where P: Parsable<T, ApplyMatchTo = P>, T: ConsumableToken,

§

type ApplyMatchTo = P

source§

fn parse(iter: &mut TokenIter<T>) -> Result<Box<P, Global>, ParseError<T>>where Box<P, Global>: Sized,

source§

fn parse_if_match<F>( iter: &mut TokenIter<T>, matches: F, pattern: Option<&'static str> ) -> Result<Box<P, Global>, ParseError<T>>where F: Fn(&<Box<P, Global> as Parsable<T>>::ApplyMatchTo) -> bool, Box<P, Global>: Sized,

source§

impl<T, P> Parsable<T> for Vec<P, Global>where P: Parsable<T, ApplyMatchTo = P>, T: ConsumableToken,

§

type ApplyMatchTo = P

source§

fn parse(iter: &mut TokenIter<T>) -> Result<Vec<P, Global>, ParseError<T>>

source§

fn parse_if_match<F>( iter: &mut TokenIter<T>, matches: F, pattern: Option<&'static str> ) -> Result<Vec<P, Global>, ParseError<T>>where F: Fn(&<Vec<P, Global> as Parsable<T>>::ApplyMatchTo) -> bool,

source§

impl<P1, P2, P3, P4, T> Parsable<T> for (P1, P2, P3, P4)where P1: Parsable<T>, P2: Parsable<T>, P3: Parsable<T>, P4: Parsable<T>, T: ConsumableToken,

Implementors§