growthbook-rust 0.1.1

Official Growthbook Rust SDK
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::condition::use_case::ConditionsMatchesAttributes;
use crate::dto::GrowthBookFeatureRuleParentData;
use crate::model_public::{FeatureResult, GrowthBookAttribute, GrowthBookAttributeValue};

impl GrowthBookFeatureRuleParentData {
    pub fn is_met(
        &self,
        feature: FeatureResult,
    ) -> bool {
        if let Some(feature_attributes) = self.conditions() {
            feature_attributes.matches(&[GrowthBookAttribute::new(String::from("value"), GrowthBookAttributeValue::from(feature.value))])
        } else {
            true
        }
    }
}