macro_rules_attribute

Macro attribute_alias

Source
macro_rules! attribute_alias {
    (
    $(
        #[apply($name:ident $(!)?)] = $( #[$($attrs:tt)*] )+;
    )*
) => { ... };
}
Expand description

Convenience macro to define new attribute aliases.

The so-defined macros are intended to be used by #[apply].

§Examples

#[macro_use]
extern crate macro_rules_attribute;

attribute_alias! {
   #[apply(complex_cfg)] = #[cfg(
       any(
           test,
           doc,
           all(
               feature = "some very complex cfg",
               target_arch = "…",
           ),
       )
   )];

   #[apply(NOT_PART_OF_THE_PUBLIC_API!)] =
       /// Not part of the public API
       #[doc(hidden)]
   ;
}

#[apply(complex_cfg)]
struct Foo {
   // …
}

#[apply(NOT_PART_OF_THE_PUBLIC_API!)]
pub mod __macro_internals {
   // …
}