Skip to main content

ParseBufferExt

Trait ParseBufferExt 

Source
pub trait ParseBufferExt<'a> {
    // Required methods
    fn look_and_eat<T: Eat>(&self, token: T, lookahead: &Lookahead1<'a>) -> bool;
    fn eat<T: Eat>(&self, t: T) -> bool;
    fn eat2<T1: Eat, T2: Eat>(&self, t1: T1, t2: T2) -> bool;
    fn eat3<T1: Eat, T2: Eat, T3: Eat>(&self, t1: T1, t2: T2, t3: T3) -> bool;
    fn parse_comma_sep<T>(
        &self,
        p: fn(ParseStream<'_>) -> Result<T>,
    ) -> Result<Vec<T>>;
}
Expand description

Extension methods for syn::parse::ParseBuffer.

Required Methods§

Source

fn look_and_eat<T: Eat>(&self, token: T, lookahead: &Lookahead1<'a>) -> bool

Source

fn eat<T: Eat>(&self, t: T) -> bool

Consumes a token T if present.

Source

fn eat2<T1: Eat, T2: Eat>(&self, t1: T1, t2: T2) -> bool

Consumes two tokens T1 T2 if present in that order.

Source

fn eat3<T1: Eat, T2: Eat, T3: Eat>(&self, t1: T1, t2: T2, t3: T3) -> bool

Consumes three tokens T1 T2 T3 if present in that order.

Source

fn parse_comma_sep<T>( &self, p: fn(ParseStream<'_>) -> Result<T>, ) -> Result<Vec<T>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> ParseBufferExt<'a> for ParseBuffer<'a>

Source§

fn look_and_eat<T: Eat>(&self, token: T, lookahead: &Lookahead1<'a>) -> bool

Consumes a token T if present, looking it up using the provided Lookahead1 instance.

Source§

fn eat<T: Eat>(&self, t: T) -> bool

Source§

fn eat2<T1: Eat, T2: Eat>(&self, t1: T1, t2: T2) -> bool

Source§

fn eat3<T1: Eat, T2: Eat, T3: Eat>(&self, t1: T1, t2: T2, t3: T3) -> bool

Source§

fn parse_comma_sep<T>( &self, p: fn(ParseStream<'_>) -> Result<T>, ) -> Result<Vec<T>>

Implementors§