pub trait AttributeExt: Debug {
Show 19 methods
    // Required methods
    fn id(&self) -> AttrId;
    fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>>;
    fn value_str(&self) -> Option<Symbol>;
    fn value_span(&self) -> Option<Span>;
    fn ident(&self) -> Option<Ident>;
    fn path_matches(&self, name: &[Symbol]) -> bool;
    fn is_doc_comment(&self) -> Option<Span>;
    fn span(&self) -> Span;
    fn is_word(&self) -> bool;
    fn ident_path(&self) -> Option<SmallVec<[Ident; 1]>>;
    fn doc_str(&self) -> Option<Symbol>;
    fn is_automatically_derived_attr(&self) -> bool;
    fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)>;
    fn doc_resolution_scope(&self) -> Option<AttrStyle>;
    // Provided methods
    fn name(&self) -> Option<Symbol> { ... }
    fn has_name(&self, name: Symbol) -> bool { ... }
    fn has_any_name(&self, names: &[Symbol]) -> bool { ... }
    fn path(&self) -> SmallVec<[Symbol; 1]> { ... }
    fn is_proc_macro_attr(&self) -> bool { ... }
}Required Methods§
fn id(&self) -> AttrId
Sourcefn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>>
 
fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>>
Get the meta item list, #[attr(meta item list)]
Sourcefn value_str(&self) -> Option<Symbol>
 
fn value_str(&self) -> Option<Symbol>
Gets the value literal, as string, when using #[attr = value]
Sourcefn value_span(&self) -> Option<Span>
 
fn value_span(&self) -> Option<Span>
Gets the span of the value literal, as string, when using #[attr = value]
Sourcefn ident(&self) -> Option<Ident>
 
fn ident(&self) -> Option<Ident>
For a single-segment attribute, returns its ident; otherwise, returns None.
Sourcefn path_matches(&self, name: &[Symbol]) -> bool
 
fn path_matches(&self, name: &[Symbol]) -> bool
Checks whether the path of this attribute matches the name.
Matches one segment of the path to each element in name
Sourcefn is_doc_comment(&self) -> Option<Span>
 
fn is_doc_comment(&self) -> Option<Span>
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
Sourcefn 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.
- ///docreturns- Some("doc").
- #[doc = "doc"]returns- Some("doc").
- #[doc(...)]returns- None.
fn is_automatically_derived_attr(&self) -> bool
Sourcefn 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.
- ///docreturns- Some(("doc", CommentKind::Line)).
- /** doc */returns- Some(("doc", CommentKind::Block)).
- #[doc = "doc"]returns- Some(("doc", CommentKind::Line)).
- #[doc(...)]returns- None.
Sourcefn doc_resolution_scope(&self) -> Option<AttrStyle>
 
fn doc_resolution_scope(&self) -> Option<AttrStyle>
Returns outer or inner if this is a doc attribute or a sugared doc comment, otherwise None.
This is used in the case of doc comments on modules, to decide whether to resolve intra-doc links against the symbols in scope within the commented module (for inner doc) vs within its parent module (for outer doc).
Provided Methods§
Sourcefn name(&self) -> Option<Symbol>
 
fn name(&self) -> Option<Symbol>
For a single-segment attribute (i.e., #[attr] and not #[path::atrr]),
return the name of the attribute; otherwise, returns None.