From 9588367284139266b55936d93428355cfa6de906 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 14 May 2023 12:11:54 +0200 Subject: feat: add deserializer-static-generics conditional compilation macro --- src/util.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/util.rs') 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}; -- cgit v1.2.3-18-g5258