pub struct LocalEvaluator { /* private fields */ }Expand description
Evaluates feature flags using locally cached definitions.
The evaluator reads from a FlagCache to determine flag values without
making network requests. Supports cohort membership checks and flag
dependencies through the evaluation context.
Implementations§
Source§impl LocalEvaluator
impl LocalEvaluator
pub fn new(cache: FlagCache) -> Self
Sourcepub fn cache(&self) -> &FlagCache
pub fn cache(&self) -> &FlagCache
Access the underlying flag cache (e.g. to read group type mappings).
Sourcepub fn evaluate_flag(
&self,
key: &str,
distinct_id: &str,
person_properties: &HashMap<String, Value>,
groups: &HashMap<String, String>,
group_properties: &HashMap<String, HashMap<String, Value>>,
) -> Result<Option<FlagValue>, InconclusiveMatchError>
pub fn evaluate_flag( &self, key: &str, distinct_id: &str, person_properties: &HashMap<String, Value>, groups: &HashMap<String, String>, group_properties: &HashMap<String, HashMap<String, Value>>, ) -> Result<Option<FlagValue>, InconclusiveMatchError>
Evaluate a feature flag locally with full context support.
Supports cohort membership checks, flag dependency evaluation, and
group / mixed-targeting flags. groups and group_properties are
only consulted when the flag (or one of its conditions) targets a
group via aggregation_group_type_index; pass empty maps for
person-targeted flags.
Sourcepub fn evaluate_flag_simple(
&self,
key: &str,
distinct_id: &str,
person_properties: &HashMap<String, Value>,
groups: &HashMap<String, String>,
group_properties: &HashMap<String, HashMap<String, Value>>,
) -> Result<Option<FlagValue>, InconclusiveMatchError>
pub fn evaluate_flag_simple( &self, key: &str, distinct_id: &str, person_properties: &HashMap<String, Value>, groups: &HashMap<String, String>, group_properties: &HashMap<String, HashMap<String, Value>>, ) -> Result<Option<FlagValue>, InconclusiveMatchError>
Evaluate a feature flag locally (simple version without cohort/flag dependency support). Use this when you know the flag doesn’t have cohort or flag dependency conditions.
Sourcepub fn evaluate_all_flags(
&self,
distinct_id: &str,
person_properties: &HashMap<String, Value>,
groups: &HashMap<String, String>,
group_properties: &HashMap<String, HashMap<String, Value>>,
) -> HashMap<String, Result<FlagValue, InconclusiveMatchError>>
pub fn evaluate_all_flags( &self, distinct_id: &str, person_properties: &HashMap<String, Value>, groups: &HashMap<String, String>, group_properties: &HashMap<String, HashMap<String, Value>>, ) -> HashMap<String, Result<FlagValue, InconclusiveMatchError>>
Get all flags and evaluate them with full context support.
Trait Implementations§
Source§impl Clone for LocalEvaluator
impl Clone for LocalEvaluator
Source§fn clone(&self) -> LocalEvaluator
fn clone(&self) -> LocalEvaluator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more