diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/mod.rs | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index dbd1455..28d18f1 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,4 +1,3 @@ - //! A set of utilities to help with common use cases that are not required to //! fully use the library. @@ -109,6 +108,56 @@ macro_rules! request { }}; } +// Enable/disable check for voice +macro_rules! feature_voice { + ($enabled:block) => { + { + feature_voice_enabled! {{ + $enabled + }} + } + }; + ($enabled:block $disabled:block) => { + { + feature_voice_enabled! {{ + $enabled + }} + + feature_voice_disabled! {{ + $disabled + }} + } + }; +} + +#[cfg(feature="voice")] +macro_rules! feature_voice_enabled { + ($enabled:block) => { + { + $enabled + } + } +} + +#[cfg(not(feature="voice"))] +macro_rules! feature_voice_enabled { + ($enabled:block) => {} +} + +#[cfg(feature="voice")] +macro_rules! feature_voice_disabled { + ($disabled:block) => {} +} + +#[cfg(not(feature="voice"))] +macro_rules! feature_voice_disabled { + ($disabled:block) => { + { + $disabled + } + } +} + /// Retrieves the "code" part of an [invite][`RichInvite`] out of a URL. /// /// # Examples |