Trait synthez::ParseBufferExt[][src]

pub trait ParseBufferExt: Sealed {
    fn try_parse<T>(&self) -> Result<Option<T>, Error>
    where
        T: Default + Parse + Token
;
fn is_next<T>(&self) -> bool
    where
        T: Default + Token
;
fn parse_any_ident(&self) -> Result<Ident, Error>;
fn parse_wrapped_and_punctuated<T, W, P>(
        &self
    ) -> Result<Punctuated<T, P>, Error>
    where
        P: Default + Parse + Token,
        T: Parse,
        W: Default + Token + 'static
;
fn parse_maybe_wrapped_and_punctuated<T, W, P>(
        &self
    ) -> Result<Punctuated<T, P>, Error>
    where
        P: Default + Parse + Token,
        T: Parse,
        W: Default + Token + 'static
;
fn parse_eq_or_wrapped_and_punctuated<T, W, P>(
        &self
    ) -> Result<Punctuated<T, P>, Error>
    where
        P: Default + Parse + Token,
        T: Parse,
        W: Default + Token + 'static
; fn skip_any_ident(&self) -> Result<(), Error> { ... } }
Expand description

Extension of a [syn::parse::ParseBuffer] providing common function widely used by this crate for parsing.

Required methods

Tries to parse T as the next Token.

Doesn’t move ParseBuffer’s cursor if there is no T.

Errors

If T fails to be parsed.

Checks whether the next Token is T.

Doesn’t move ParseBuffer’s cursor.

Parses the next Token as syn::Ident allowing Rust keywords, while default Parse implementation for syn::Ident disallows them.

Always moves ParseBuffer’s cursor.

Errors

If syn::Ident fails to be parsed.

Parses the wrapped (in a wrapper W) Tokens as T Punctuated with a P separator.

Always moves ParseBuffer’s cursor.

Errors

If parsing Punctuated T wrapped into W fails.

Checks whether the next Token is a wrapper W and if yes, then parses the wrapped Tokens as T Punctuated with a P separator. Otherwise, parses just T.

Always moves ParseBuffer’s cursor.

Errors

If either parsing Punctuated T wrapped into W, or parsing just T, fails.

Checks whether the next Token is a wrapper W and if yes, then parses the wrapped Tokens as T Punctuated with a P separator. Otherwise, parses just T following the token::Eq.

Always moves ParseBuffer’s cursor.

Errors

If either parsing Punctuated T wrapped into W, or parsing just T following the token::Eq, fails.

Provided methods

Parses the next Token as syn::Ident allowing Rust keywords, while default Parse implementation for syn::Ident disallows them. Drops the parsed Token in-place.

Always moves ParseBuffer’s cursor.

Errors

If syn::Ident fails to be parsed.

Implementations on Foreign Types

Implementors