aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-05-14 12:11:54 +0200
committerHampusM <hampus@hampusmat.com>2023-05-14 12:11:54 +0200
commit9588367284139266b55936d93428355cfa6de906 (patch)
tree6a189382758a86be3ac0a396e6d236fe91e65b1a /src/util.rs
parent1ffc8cbafc4439435307831e87d6f3c265ad819c (diff)
feat: add deserializer-static-generics conditional compilation macro
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs19
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};