Skip to main content

rullst_core/feature/
driver.rs

1use async_trait::async_trait;
2
3// ─── Feature Driver Trait ───────────────────────────────────────────────────
4
5/// Abstraction over feature flag and A/B split configurations.
6#[async_trait]
7pub trait FeatureDriver: Send + Sync {
8    /// Check if a feature flag is enabled.
9    async fn enabled(&self, flag: &str) -> Option<bool>;
10
11    /// Check if a feature flag is enabled for a specific target identifier.
12    async fn enabled_for(&self, flag: &str, identifier: &str) -> Option<bool>;
13
14    /// Retrieve the variation name assigned to a specific target identifier.
15    async fn variant(&self, flag: &str, identifier: &str) -> Option<String>;
16}