growthbook_sdk_rust/feature/
feature_rule_parent.rs

1use crate::condition::use_case::ConditionsMatchesAttributes;
2use crate::dto::GrowthBookFeatureRuleParentData;
3use crate::model_private::FeatureResult;
4use crate::model_public::{GrowthBookAttribute, GrowthBookAttributeValue};
5
6impl GrowthBookFeatureRuleParentData {
7    pub fn is_met(
8        &self,
9        feature: FeatureResult,
10    ) -> bool {
11        if let Some(feature_attributes) = self.conditions() {
12            feature_attributes.matches(&[GrowthBookAttribute::new(String::from("value"), GrowthBookAttributeValue::from(feature.value))])
13        } else {
14            true
15        }
16    }
17}