pub fn matches(&self, user: &User, key: &str, salt: &str) -> bool {
        // rules match if _all_ of their clauses do
        for clause in &self.clauses {
            if !clause.matches_non_segment(user) {
                return false;
            }
        }

        match self.weight {
            Some(weight) if weight >= 0.0 => {
                let bucket_by = self.bucket_by.as_deref();
                let prefix = BucketPrefix::KeyAndSalt(key, salt);
                let bucket = user.bucket(bucket_by, prefix);
                bucket < weight / 100_000.0
            }
            _ => true,
        }
    }
/// Determines if a user matches the provided segment rule.
///
/// A user will match if all segment clauses match; otherwise, this method returns false.
Determines if a user matches the provided segment rule.
A user will match if all segment clauses match; otherwise, this method returns false.
Determines if a user matches the provided segment rule . A user will match if all segment clauses match ; otherwise this method returns false .
pub fn matches(&self, user: &User, key: &str, salt: &str) -> bool {
        // rules match if _all_ of their clauses do
        for clause in &self.clauses {
            if !clause.matches_non_segment(user) {
                return false;
            }
        }
        match self.weight {
            Some(weight) if weight >= 0.0 => {
                let bucket_by = self.bucket_by.as_deref();
                let prefix = BucketPrefix::KeyAndSalt(key, salt);
                let bucket = user.bucket(bucket_by, prefix);
                bucket < weight / 100_000.0
            }
            _ => true,
        }
    }
pub fn matches ( & self , user : & User , key : & str , salt : & str ) -> bool { // rules match if _all_ of their clauses do for clause in & self . clauses { if ! clause . matches_non_segment ( user ) { return false ; } } match self . weight { Some ( weight ) if weight >= 0.0 => { let bucket_by = self . bucket_by . as_deref ( ) ; let prefix = BucketPrefix :: KeyAndSalt ( key , salt ) ; let bucket = user . bucket ( bucket_by , prefix ) ; bucket < weight / 100_000.0 } _ => true , } }
Determines if a user matches the provided segment rule.
Determines if a user matches the provided segment rule .
&self
user
&User
key
&str
salt
&str
&self
user
&User
key
&str
salt
&str