pub struct FeatureFlagEvaluations { /* private fields */ }Expand description
A snapshot of evaluated feature flags for one distinct_id.
Returned by Client::evaluate_flags. Reading
flags via is_enabled or get_flag both records the access (so it can be
later attached to a capture event) and emits a deduplicated
$feature_flag_called event. get_flag_payload is intentionally event-free.
Implementations§
Source§impl FeatureFlagEvaluations
impl FeatureFlagEvaluations
Sourcepub fn is_enabled(&self, key: &str) -> bool
pub fn is_enabled(&self, key: &str) -> bool
Whether key is enabled. Records the access and fires (deduplicated)
$feature_flag_called.
§Returns
true for enabled boolean flags or matched multivariate variants, and
false for disabled or missing flags.
Sourcepub fn get_flag(&self, key: &str) -> Option<FlagValue>
pub fn get_flag(&self, key: &str) -> Option<FlagValue>
Look up the value of key.
§Returns
Nonewhen the flag is not in the snapshot,Some(FlagValue::Boolean(false))when disabled,Some(FlagValue::String(variant))for a multivariate match,Some(FlagValue::Boolean(true))when enabled with no variant.
Records the access and fires (deduplicated) $feature_flag_called.
Sourcepub fn get_flag_payload(&self, key: &str) -> Option<Value>
pub fn get_flag_payload(&self, key: &str) -> Option<Value>
Return the JSON payload associated with key, if any.
§Remarks
This call does not count as an access and does not fire any event, matching the behavior documented for server-side SDKs.
Sourcepub fn only_accessed(&self) -> Self
pub fn only_accessed(&self) -> Self
A clone of the snapshot containing only flags whose values were read via
is_enabled or get_flag before
this call.
Order-dependent: if nothing has been accessed yet, the returned snapshot is empty. Pre-access the flags you want to attach before calling this.
Sourcepub fn only(&self, keys: &[&str]) -> Self
pub fn only(&self, keys: &[&str]) -> Self
A clone of the snapshot containing only the listed keys (preserving
records). Unknown keys are dropped and surfaced via a single warning.
Use this before Event::with_flags to limit
the $feature/<key> properties attached to a captured event.