add-syntax
Attribute macros that prepend or append arbitrary syntax. Useful with
cfg_attr
.
This crate provides two attribute macros, prepend
and append
, that
add the tokens passed to them to the start or end of the item to which the
attribute is applied, respectively. This is particularly useful with
cfg_attr
.
Example
Conditionally applying unsafe
when #[may_dangle]
is used:
If the hypothetical feature dropck_eyepatch
is enabled, the code above
is equivalent to:
unsafe
Otherwise, if the feature is not enabled, the code is equivalent to: