pub trait ParseBufferExt: Sealed {
    // Required methods
    fn parse_bool_attr(&self) -> Result<bool, Error>;
    fn parse_valued_attr<P>(&self) -> Result<P, Error>
       where P: Parse;
    fn iter_delimited<T, D>(&self) -> DelimitedIter<'_, T, D> 
       where T: Parse,
             D: Parse;
}
Available on crate feature attr_parse only.
Expand description

ParseBuffer extensions

Required Methods§

source

fn parse_bool_attr(&self) -> Result<bool, Error>

Parse a boolean attribute

ValueResult
my_attrtrue
my_attr(true)true
my_attr(false)false
my_attr = truetrue
my_attr = falsefalse
source

fn parse_valued_attr<P>(&self) -> Result<P, Error>where P: Parse,

Parse a valued attribute

ValueResult
my_attr(something)P::parse(something)
my_attr = somethingP::parse(something)

The my_attr(something) syntax should be preferred as my_attr = something can’t always deserialise some types (e.g. Visibility)

source

fn iter_delimited<T, D>(&self) -> DelimitedIter<'_, T, D> where T: Parse, D: Parse,

Shortcut for DelimitedIter::new

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

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

source§

fn parse_bool_attr(&self) -> Result<bool, Error>

source§

fn parse_valued_attr<P>(&self) -> Result<P, Error>where P: Parse,

source§

fn iter_delimited<T, D>(&self) -> DelimitedIter<'_, T, D> where T: Parse, D: Parse,

Implementors§