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.
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. This call does
not count as an access and does not fire any event.
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.