Trait CombineAttributeParser

Source
pub(crate) trait CombineAttributeParser: 'static {
    type Item;

    const PATH: &'static [Symbol];
    const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind;

    // Required method
    fn extend<'a>(
        cx: &'a AcceptContext<'a>,
        args: &'a ArgParser<'a>,
    ) -> impl IntoIterator<Item = Self::Item> + 'a;
}
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§

Source

const PATH: &'static [Symbol]

Source

const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind

Required Associated Types§

Required Methods§

Source

fn extend<'a>( cx: &'a AcceptContext<'a>, args: &'a ArgParser<'a>, ) -> impl IntoIterator<Item = Self::Item> + 'a

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.

Implementors§

Source§

impl CombineAttributeParser for AllowConstFnUnstableParser

Source§

const PATH: &'static [Symbol]

Source§

const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind = {rustc_attr_data_structures::AttributeKind::AllowConstFnUnstable as fn(thin_vec::ThinVec<<attributes::allow_unstable::AllowConstFnUnstableParser as attributes::CombineAttributeParser>::Item>) -> rustc_attr_data_structures::AttributeKind}

Source§

type Item = Symbol

Source§

impl CombineAttributeParser for AllowInternalUnstableParser

Source§

const PATH: &'static [Symbol]

Source§

const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind = {rustc_attr_data_structures::AttributeKind::AllowInternalUnstable as fn(thin_vec::ThinVec<<attributes::allow_unstable::AllowInternalUnstableParser as attributes::CombineAttributeParser>::Item>) -> rustc_attr_data_structures::AttributeKind}

Source§

type Item = (Symbol, Span)

Source§

impl CombineAttributeParser for ReprParser

Source§

const PATH: &'static [Symbol]

Source§

const CONVERT: fn(ThinVec<Self::Item>) -> AttributeKind = {rustc_attr_data_structures::AttributeKind::Repr as fn(thin_vec::ThinVec<<attributes::repr::ReprParser as attributes::CombineAttributeParser>::Item>) -> rustc_attr_data_structures::AttributeKind}

Source§

type Item = (ReprAttr, Span)