pub trait HasAttrs {
const SUPPORTS_CUSTOM_INNER_ATTRS: bool;
// Required methods
fn attrs(&self) -> &[Attribute];
fn visit_attrs(&mut self, f: impl FnOnce(&mut AttrVec));
}
Expand description
A trait for AST nodes having (or not having) attributes.
Required Associated Constants§
Sourceconst SUPPORTS_CUSTOM_INNER_ATTRS: bool
const SUPPORTS_CUSTOM_INNER_ATTRS: bool
This is true
if this HasAttrs
might support ‘custom’ (proc-macro) inner
attributes. Attributes like #![cfg]
and #![cfg_attr]
are not
considered ‘custom’ attributes.
If this is false
, then this HasAttrs
definitely does
not support ‘custom’ inner attributes, which enables some optimizations
during token collection.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.