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