Expand description
Metadata associated with an item.
Fields
kind: AttrKindid: AttrIdstyle: AttrStyleDenotes if the attribute decorates the following construct (outer) or the construct this attribute is contained within (inner).
span: SpanImplementations
sourceimpl Attribute
impl Attribute
pub fn has_name(&self, name: Symbol) -> bool
sourcepub fn ident(&self) -> Option<Ident>
pub fn ident(&self) -> Option<Ident>
For a single-segment attribute, returns its name; otherwise, returns None.
pub fn name_or_empty(&self) -> Symbol
pub fn value_str(&self) -> Option<Symbol>
pub fn meta_item_list(&self) -> Option<Vec<NestedMetaItem>>
pub fn is_word(&self) -> bool
sourceimpl Attribute
impl Attribute
pub fn is_doc_comment(&self) -> bool
pub fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)>
pub fn doc_str(&self) -> Option<Symbol>
pub fn get_normal_item(&self) -> &AttrItem
pub fn unwrap_normal_item(self) -> AttrItem
pub fn meta_kind(&self) -> Option<MetaItemKind>
pub fn tokens(&self) -> AttrAnnotatedTokenStream
Trait Implementations
sourceimpl AstLike for Attribute
impl AstLike for Attribute
sourceconst SUPPORTS_CUSTOM_INNER_ATTRS: bool
const SUPPORTS_CUSTOM_INNER_ATTRS: bool
This is true if this AstLike might support ‘custom’ (proc-macro) inner
attributes. Attributes like #![cfg] and #![cfg_attr] are not
considered ‘custom’ attributes Read more
fn attrs(&self) -> &[Attribute]
fn visit_attrs(&mut self, _f: impl FnOnce(&mut Vec<Attribute>))
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>>
sourceimpl<AstCtx: HashStableContext> HashStable<AstCtx> for Attribute
impl<AstCtx: HashStableContext> HashStable<AstCtx> for Attribute
fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher)
Auto Trait Implementations
impl !RefUnwindSafe for Attribute
impl !Send for Attribute
impl !Sync for Attribute
impl Unpin for Attribute
impl !UnwindSafe for Attribute
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes