AttributeExt12

Trait AttributeExt12 

Source
pub trait AttributeExt12 {
    // Required method
    fn call_in_parens<T, F>(&self, f: F) -> Result<T>
       where F: FnOnce(ParseStream<'_>) -> Result<T>;

    // Provided method
    fn parse_in_parens<T: Parse>(&self) -> Result<T> { ... }
}
Expand description

Helper trait to deal with syn’s idea of attribute contents

We expect all our attributes to be parenthesised.

Required Methods§

Source

fn call_in_parens<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(ParseStream<'_>) -> Result<T>,

Like parse_in_parens, but takes a parser callback.

Provided Methods§

Source

fn parse_in_parens<T: Parse>(&self) -> Result<T>

Parse the content within an #[attribute(content)]

Parses the content as T.

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.

Implementations on Foreign Types§

Source§

impl AttributeExt12 for Attribute

Source§

fn call_in_parens<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(ParseStream<'_>) -> Result<T>,

Implementors§