Crate featureflag

Source
Expand description

Feature flagging facade for Rust.

This library provides a flexible and extensible way to control feature flags in Rust applications.

The core trait of this library is the Evaluator, which is used to evaluate feature flags at runtime.

The context! macro and Context type can be in evaluators to provide contextual information for feature flag evaluation, such as user ID and session ID.

The is_enabled! macro is the primary way to check if a feature is enabled. This macro takes a feature name and a default value, and returns a boolean indicating whether the feature is enabled or not. Alternatively, the feature! macro can be used to store a Feature is a variable or constant, or the Feature::new or Feature::new_with_default_fn methods can be used directly to create new feature flags at runtime.

Re-exports§

pub use crate::context::Context;
pub use crate::evaluator::Evaluator;
pub use crate::evaluator::set_global_default;
pub use crate::evaluator::try_set_global_default;
pub use crate::feature::Feature;

Modules§

context
Context values for context-aware features.
evaluator
Evaluators of feature flags.
extensions
Extensions for storing custom data in Contexts.
feature
Feature flags.
fields
Fields struct and macro for creating a collection of fields for use in context!.
utils
This module provides utilities for wrapping types with a Context or Evaluator.
value
Value types for the context! macro.

Macros§

context
Create a new context with the given fields.
feature
Define a feature flag at compile-time.
fields
Creates a new Fields instance with the given fields.
is_enabled
Check if a feature is enabled.