[][src]Struct amplify_derive_helpers::ParametrizedAttr

pub struct ParametrizedAttr {
    pub name: Ident,
    pub args: HashMap<String, ArgValue>,
    pub paths: Vec<Path>,
    pub integers: Vec<LitInt>,
    pub literal: Option<Lit>,
}

Representation for all allowed forms of #[attr(...)] attribute. If attribute has a multiple occurrences they are all assembled into a single list. Repeated named arguments are not allowed and result in errors.

For situations like in #[attr("string literal")], ParametrizedAttr will have a name field set to attr, literal field set to Lit::LitStr(LitStr("string literal")), args will be an empty HashSet and paths will be represented by an empty vector.

Fields

name: Ident

Attribute name - attr part of #[attr(...)]

args: HashMap<String, ArgValue>

All attribute arguments that have form of #[attr(ident = "literal")] or #[attr(ident = TypeName)] mapped to their name identifiers

paths: Vec<Path>

All attribute arguments that are paths or identifiers without any specific value, like #[attr(std::io::Error, crate, super::SomeType)].

integers: Vec<LitInt>

Unnamed integer literals found within attribute arguments

literal: Option<Lit>

Unnamed literal value found in the list of attribute arguments. If multiple literals are found they must be a string literals and are concatenated into a single value, like it is done by the rust compiler for #[doc = "..."] attributes

Implementations

impl ParametrizedAttr[src]

pub fn with_name(name: Ident) -> Self[src]

pub fn with_attribute(attr: &Attribute) -> Result<Self, Error>[src]

pub fn arg_literal_value(&self, name: &str) -> Result<Lit, Error>[src]

pub fn has_verbatim(&self, verbatim: &str) -> bool[src]

pub fn merge(&mut self, other: Self) -> Result<(), Error>[src]

pub fn merged(mut self: Self, other: Self) -> Result<Self, Error>[src]

pub fn enrich(&mut self, attr: &Attribute) -> Result<(), Error>[src]

pub fn enriched(mut self: Self, attr: &Attribute) -> Result<Self, Error>[src]

pub fn fuse(&mut self, nested: NestedMeta) -> Result<(), Error>[src]

pub fn fused(mut self: Self, nested: NestedMeta) -> Result<Self, Error>[src]

pub fn check(&self, _req: AttrReq) -> Result<(), Error>[src]

pub fn checked(self, req: AttrReq) -> Result<Self, Error>[src]

Trait Implementations

impl Clone for ParametrizedAttr[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.