Skip to main content

Crate toggly_macros

Crate toggly_macros 

Source
Expand description

§Toggly Macros

Procedural macros for Toggly feature flags.

§Feature Guard Macro

The #[feature_flag] attribute macro guards a function with a feature flag check.

use toggly_macros::feature_flag;

#[feature_flag("my-feature")]
async fn my_feature_function() -> String {
    "Feature is enabled!".to_string()
}

§Options

  • feature - The feature key (required)
  • client - Expression to get the client (default: from context)
  • context - Expression to get the evaluation context (default: Default::default())
  • fallback - Return value when feature is disabled
  • negate - Invert the feature check

Macros§

feature_gate
Macro for conditional compilation based on feature flags at runtime.

Attribute Macros§

feature_flag
Guard a function with a feature flag check.

Derive Macros§

FeatureFlags
Derive macro for creating feature flag enums.