pub struct Attribute {
pub kind: AttrKind,
pub id: AttrId,
pub style: AttrStyle,
pub span: Span,
}
Fields§
§kind: AttrKind
§id: AttrId
§style: AttrStyle
Denotes if the attribute decorates the following construct (outer) or the construct this attribute is contained within (inner).
span: Span
Implementations§
Source§impl Attribute
impl Attribute
pub fn get_normal_item(&self) -> &AttrItem
pub fn unwrap_normal_item(self) -> AttrItem
pub fn value_lit(&self) -> Option<&MetaItemLit>
Source§impl Attribute
impl Attribute
pub fn id(&self) -> AttrId
pub fn name_or_empty(&self) -> Symbol
pub fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>>
pub fn value_str(&self) -> Option<Symbol>
pub fn value_span(&self) -> Option<Span>
pub fn ident(&self) -> Option<Ident>
pub fn path_matches(&self, name: &[Symbol]) -> bool
pub fn is_doc_comment(&self) -> bool
pub fn has_name(&self, name: Symbol) -> bool
pub fn span(&self) -> Span
pub fn is_word(&self) -> bool
pub fn path(&self) -> SmallVec<[Symbol; 1]>
pub fn ident_path(&self) -> Option<SmallVec<[Ident; 1]>>
pub fn doc_str(&self) -> Option<Symbol>
pub fn is_proc_macro_attr(&self) -> bool
pub fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)>
pub fn style(&self) -> AttrStyle
Trait Implementations§
Source§impl<'tcx> ArenaAllocatable<'tcx> for Attribute
impl<'tcx> ArenaAllocatable<'tcx> for Attribute
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut Self
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = Self>, ) -> &'tcx mut [Self]
Source§impl AttributeExt for Attribute
impl AttributeExt for Attribute
Source§fn ident(&self) -> Option<Ident>
fn ident(&self) -> Option<Ident>
For a single-segment attribute, returns its name; otherwise, returns None
.
fn id(&self) -> AttrId
Source§fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>>
fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>>
Get the meta item list,
#[attr(meta item list)]
Source§fn value_str(&self) -> Option<Symbol>
fn value_str(&self) -> Option<Symbol>
Gets the value literal, as string, when using
#[attr = value]
Source§fn value_span(&self) -> Option<Span>
fn value_span(&self) -> Option<Span>
Gets the span of the value literal, as string, when using
#[attr = value]
Source§fn path_matches(&self, name: &[Symbol]) -> bool
fn path_matches(&self, name: &[Symbol]) -> bool
Checks whether the path of this attribute matches the name. Read more
Source§fn is_doc_comment(&self) -> bool
fn is_doc_comment(&self) -> bool
Returns
true
if it is a sugared doc comment (///
or //!
for example).
So #[doc = "doc"]
(which is a doc comment) and #[doc(...)]
(which is not
a doc comment) will return false
.fn is_word(&self) -> bool
Source§fn doc_str(&self) -> Option<Symbol>
fn doc_str(&self) -> Option<Symbol>
Returns the documentation if this is a doc comment or a sugared doc comment. Read more
Source§fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)>
fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)>
Returns the documentation and its kind if this is a doc comment or a sugared doc comment. Read more
fn style(&self) -> AttrStyle
fn name_or_empty(&self) -> Symbol
fn has_name(&self, name: Symbol) -> bool
fn path(&self) -> SmallVec<[Symbol; 1]>
fn is_proc_macro_attr(&self) -> bool
Source§impl<__D: SpanDecoder> Decodable<__D> for Attribute
impl<__D: SpanDecoder> Decodable<__D> for Attribute
Source§impl<__E: SpanEncoder> Encodable<__E> for Attribute
impl<__E: SpanEncoder> Encodable<__E> for Attribute
Source§impl<HirCtx: HashStableContext> HashStable<HirCtx> for Attribute
impl<HirCtx: HashStableContext> HashStable<HirCtx> for Attribute
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher)
Auto Trait Implementations§
impl DynSend for Attribute
impl DynSync for Attribute
impl Freeze for Attribute
impl !RefUnwindSafe for Attribute
impl !Send for Attribute
impl !Sync for Attribute
impl Unpin for Attribute
impl !UnwindSafe for Attribute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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: 32 bytes