pub trait AttributeExt: Debug + 'static {
// Required methods
fn name(&self) -> Option<Symbol>;
fn value_str(&self) -> Option<Symbol>;
fn path_matches(&self, name: &[Symbol]) -> bool;
fn doc_str_and_fragment_kind(
&self,
) -> Option<(Symbol, DocFragmentKind, Span)>;
fn doc_resolution_scope(&self) -> Option<AttrStyle>;
}Required 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.
Sourcefn value_str(&self) -> Option<Symbol>
fn value_str(&self) -> Option<Symbol>
Gets the value literal, as string, when using #[attr = value]
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 doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind, Span)>
fn doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind, Span)>
Returns the documentation and its kind if this is a doc comment or a sugared doc comment.
///docreturnsSome(("doc", CommentKind::Line))./** doc */returnsSome(("doc", CommentKind::Block)).#[doc = "doc"]returnsSome(("doc", CommentKind::Line)).#[doc(...)]returnsNone.
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).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".