devela/code/util/
deprecate.rs#[macro_export]
#[cfg_attr(cargo_primary_package, doc(hidden))]
macro_rules! deprecate_feature {
( old: $old_feature:literal
$(, new: $new_feature:literal )?
$(, since: $since:literal )?
) => {
$crate::paste! {
#[$crate::compile_attr(
all( none($($new_feature)?), none($($since)?) ),
deprecated(note = "\nWARNING. `" $old_feature
"` feature deprecated." )
)]
#[$crate::compile_attr(
all( none($($new_feature)?), some($($since)?) ),
deprecated( $(since = $since,)? note = "\nWARNING. `" $old_feature
"` feature deprecated since version " $($since)? "." )
)]
#[$crate::compile_attr(
all( some($($new_feature)?), none($($since)?) ),
deprecated(note = "\nWARNING. `" $old_feature
"` feature deprecated, use `" $($new_feature)? "` instead." )
)]
#[$crate::compile_attr(
all( some($($new_feature)?), some($($since)?) ),
deprecated( $(since = $since,)? note = "\nWARNING. `" $old_feature
"` feature deprecated since version " $($since)?
", use `" $($new_feature)? "` instead." )
)]
#[cfg(feature = $old_feature)]
const fn [<deprecate_feature_ $old_feature:snake>]() {}
#[cfg(feature = $old_feature)]
#[allow(dead_code)]
const [<DEPRECATED_ $old_feature:snake:upper>]: ()
= [<deprecate_feature_ $old_feature:snake>]();
}
};
}
#[doc(inline)]
pub use deprecate_feature;