Skip to main content

AttributeExtension

Trait AttributeExtension 

Source
pub trait AttributeExtension {
    // Required method
    fn get_self(&self) -> &Attribute;

    // Provided methods
    fn parse_comma_args<T: Parse>(&self) -> Result<Vec<T>> { ... }
    fn unfeatured_all(&self) -> Vec<Attribute> { ... }
    fn unfeatured(&self) -> Option<Attribute> { ... }
}

Required Methods§

Provided Methods§

Source

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

Parse all arguments as comma-separated types.

Source

fn unfeatured_all(&self) -> Vec<Attribute>

Unwrap all inner attributes from a feature-gated cfg_attr. E.g. #[cfg_attr(feature = "x", derive(Debug), codama(...))] returns vec![#[derive(Debug)], #[codama(...)]]. Returns an empty Vec if not a feature-gated cfg_attr.

Source

fn unfeatured(&self) -> Option<Attribute>

Unwrap the feature flag from the attribute. E.g. #[cfg_attr(feature = "some_feature", derive(Debug))] becomes the syn::Attribute defined as #[derive(Debug)]. If the cfg_attr contains multiple inner attributes, returns the first.

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 AttributeExtension for Attribute

Implementors§