pub(crate) trait CombineAttributeParser<S: Stage>: 'static {
type Item;
const PATH: &[Symbol];
const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind;
const TEMPLATE: AttributeTemplate;
// Required method
fn extend<'c>(
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = Self::Item> + 'c;
}
Expand description
Alternative to AttributeParser
that automatically handles state management.
If multiple attributes appear on an element, combines the values of each into a
ThinVec
.
Combine<T> where T: CombineAttributeParser
implements AttributeParser
.
CombineAttributeParser
can only convert a single kind of attribute, and cannot combine multiple
attributes together like is necessary for #[stable()]
and #[unstable()]
for example.
Required Associated Constants§
const PATH: &[Symbol]
Sourceconst CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind
const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind
A function that converts individual items (of type Item
) into the final attribute.
For example, individual representations fomr #[repr(...)]
attributes into an AttributeKind::Repr(x)
,
where x
is a vec of these individual reprs.
Sourceconst TEMPLATE: AttributeTemplate
const TEMPLATE: AttributeTemplate
The template this attribute parser should implement. Used for diagnostics.
Required Associated Types§
Required Methods§
Sourcefn extend<'c>(
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = Self::Item> + 'c
fn extend<'c>( cx: &'c mut AcceptContext<'_, '_, S>, args: &'c ArgParser<'_>, ) -> impl IntoIterator<Item = Self::Item> + 'c
Converts a single syntactical attribute to a number of elements of the semantic attribute, or AttributeKind
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.