[−][src]Trait syn_ext::ext::AttributeExt
Extension for syn::Attribute
Required methods
fn from_meta<M>(meta: M) -> Self where
M: IntoAttribute,
M: IntoAttribute,
Constructs and returns a new syn::Attribute from syn::Meta
fn try_meta_mut<F, R>(&mut self, f: F) -> Result<R> where
F: FnOnce(&mut Meta) -> Result<R>,
F: FnOnce(&mut Meta) -> Result<R>,
Takes a closure and calls it with parsed meta. After call, applys back the manipulated syn::Meta.
- Try syn::Attribute::parse_meta; return if
Err - Run
f - Apply back the manipulated syn::Meta by
f. - Return the result of
f.
Note: Even f returns Err, meta will be made into self.
fn promoted_list(&self) -> Result<MetaList>
Returns a fake promoted list value of syn::MetaList.
If syn::Meta::List, return inner syn::MetaList.
If syn::Meta::Path, return a fake syn::MetaList with default paren and empty nested.
Otherwise return Err
fn try_promoted_list_mut<F, R>(&mut self, paren: Paren, f: F) -> Result<R> where
F: FnOnce(&mut MetaList) -> Result<R>,
F: FnOnce(&mut MetaList) -> Result<R>,
Takes a closure and calls it with promoted list of parsed meta. After call, applys back the manipulated syn::MetaList.
- Try syn::Attribute::parse_meta; return if
Err - Promote to syn::Meta::List if syn::Meta::Path
- Run
fto inner syn::MetaList - Apply back the manipulated syn::Meta by
f. - Return the result of
f.
Implementations on Foreign Types
impl AttributeExt for Attribute[src]
fn from_meta<M>(meta: M) -> Self where
M: IntoAttribute, [src]
M: IntoAttribute,
fn try_meta_mut<F, R>(&mut self, f: F) -> Result<R> where
F: FnOnce(&mut Meta) -> Result<R>, [src]
F: FnOnce(&mut Meta) -> Result<R>,
fn promoted_list(&self) -> Result<MetaList>[src]
fn try_promoted_list_mut<F, R>(&mut self, paren: Paren, f: F) -> Result<R> where
F: FnOnce(&mut MetaList) -> Result<R>, [src]
F: FnOnce(&mut MetaList) -> Result<R>,