armature_features/lib.rs
1//! Feature Flags for Armature
2//!
3//! Comprehensive feature flag system with runtime toggling, A/B testing,
4//! gradual rollout, and optional LaunchDarkly integration.
5//!
6//! # Features
7//!
8//! - 🚀 **Feature Flags** - Toggle features at runtime
9//! - 🎯 **Targeting Rules** - User-based feature activation
10//! - 📊 **A/B Testing** - Experiment framework with multivariate support
11//! - 🎲 **Gradual Rollout** - Percentage-based feature rollout
12//! - 🔌 **LaunchDarkly** - Optional LaunchDarkly integration
13//!
14//! # Quick Start
15//!
16//! ```
17//! use armature_features::*;
18//!
19//! // Create a simple boolean flag
20//! let flag = FeatureFlag::boolean("new-ui", true);
21//!
22//! // Evaluate for a user
23//! let context = EvaluationContext::new().with_user_id("user-123");
24//! let enabled = flag.evaluate(&context).as_bool().unwrap_or(false);
25//!
26//! if enabled {
27//! // Show new UI
28//! }
29//! ```
30//!
31//! # Targeting Rules
32//!
33//! ```
34//! use armature_features::*;
35//!
36//! // Create rule for beta users
37//! let rule = TargetingRule::new(Variation::boolean(true))
38//! .with_condition(Condition::new(
39//! "email",
40//! Operator::EndsWith,
41//! vec!["@company.com".to_string()],
42//! ));
43//!
44//! let flag = FeatureFlag::boolean("beta-feature", false)
45//! .with_rule(rule);
46//! ```
47//!
48//! # Gradual Rollout
49//!
50//! ```
51//! use armature_features::*;
52//!
53//! // Roll out to 25% of users
54//! let rollout = Rollout::new(25, Variation::boolean(true));
55//! let flag = FeatureFlag::boolean("new-algorithm", false)
56//! .with_rollout(rollout);
57//! ```
58//!
59//! # A/B Testing
60//!
61//! ```
62//! use armature_features::*;
63//!
64//! // Create multivariate flag for A/B test
65//! let flag = FeatureFlag::multivariate(
66//! "button-color",
67//! vec![
68//! Variation::string("red"),
69//! Variation::string("blue"),
70//! Variation::string("green"),
71//! ],
72//! );
73//! ```
74
75pub mod flag;
76
77pub use flag::{
78 Condition, EvaluationContext, FeatureFlag, Operator, Rollout, TargetingRule, Variation,
79};