diff options
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/util.rs b/src/util.rs index 78d2cd4..5c9ffb8 100644 --- a/src/util.rs +++ b/src/util.rs @@ -10,4 +10,21 @@ macro_rules! trait_alias { }; } -pub(crate) use trait_alias; +macro_rules! feature_alternate { + ( + feature = $feature: literal, + $(#[doc = $doc: literal])* + when_enabled = $when_enabled: item, + when_disabled = $when_disabled: item + ) => { + $(#[doc = $doc])* + #[cfg(feature = $feature)] + $when_enabled + + $(#[doc = $doc])* + #[cfg(not(feature = $feature))] + $when_disabled + }; +} + +pub(crate) use {feature_alternate, trait_alias}; |