#[cfg_attrs(...)]
Provides an alternative syntax to #[cfg_attr(...)] that is easier to use with doc
comments.
Syntax
CfgAttrsAttribute :
cfg_attrs(ConfigurationPredicate,CfgAttrs)CfgAttrs :
{Attributes}| AttributesAttributes :
OuterAttribute* (,OuterAttribute* )*,?
Examples
/// This is an example struct.
;
This can also be written as:
/// This is an example struct.
;
Either of these will expand to the following usage of #[cfg_attr(...)]:
/// This is an example struct.
;
Which, if debug assertions are active, would be expanded to:
/// This is an example struct.
///
/// Hello! These are docs that only appear when
/// debug assertions are active.
;
#[cfg_attrs(...)] may also be used with attributes other than doc comments, though there is
little advantage over using #[cfg_attr(...)] in these cases:
With that example being equivalent to: