Skip to main content

FeatureFlag

Trait FeatureFlag 

Source
pub trait FeatureFlag: Send + Sync {
    // Required methods
    async fn is_enabled(&self, key: &str) -> bool;
    async fn is_enabled_for_user(&self, key: &str, user_id: &str) -> bool;
    async fn get_variant(&self, key: &str) -> Option<String>;
}
Expand description

功能开关 trait (dyn 兼容)

Required Methods§

Source

async fn is_enabled(&self, key: &str) -> bool

检查开关是否启用

Source

async fn is_enabled_for_user(&self, key: &str, user_id: &str) -> bool

检查开关是否启用 (带用户上下文)

Source

async fn get_variant(&self, key: &str) -> Option<String>

获取开关变体

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§