pub fn update(&self, val: i64) {
        let _ = self
            .max
            .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |max| {
                if val > max {
                    Some(val)
                } else {
                    None
                }
            });

        let _ = self
            .min
            .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |min| {
                if val < min {
                    Some(val)
                } else {
                    None
                }
            });

        self.sum.fetch_add(val, Ordering::SeqCst);
        self.count.fetch_add(1, Ordering::SeqCst);

        for idx in 0..=self.bounds.len() {
            // Allocate value in the last buckets if we reached the end of the Bounds array.
            if idx == self.bounds.len() {
                self.count_per_bucket[idx].fetch_add(1, Ordering::SeqCst);
                break;
            }

            if val < (self.bounds[idx].load(Ordering::SeqCst) as i64) {
                self.count_per_bucket[idx].fetch_add(1, Ordering::SeqCst);
                break;
            }
        }
    }
/// `update` changes the Min and Max fields if value is less than or greater than the current values.
`update` changes the Min and Max fields if value is less than or greater than the current values.
` update ` changes the Min and Max fields if value is less than or greater than the current values .
pub fn update(&self, val: i64) {
        let _ = self
            .max
            .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |max| {
                if val > max {
                    Some(val)
                } else {
                    None
                }
            });
        let _ = self
            .min
            .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |min| {
                if val < min {
                    Some(val)
                } else {
                    None
                }
            });
        self.sum.fetch_add(val, Ordering::SeqCst);
        self.count.fetch_add(1, Ordering::SeqCst);
        for idx in 0..=self.bounds.len() {
            // Allocate value in the last buckets if we reached the end of the Bounds array.
            if idx == self.bounds.len() {
                self.count_per_bucket[idx].fetch_add(1, Ordering::SeqCst);
                break;
            }
            if val < (self.bounds[idx].load(Ordering::SeqCst) as i64) {
                self.count_per_bucket[idx].fetch_add(1, Ordering::SeqCst);
                break;
            }
        }
    }
pub fn update ( & self , val : i64 ) { let _ = self . max . fetch_update ( Ordering :: SeqCst , Ordering :: SeqCst , | max | { if val > max { Some ( val ) } else { None } } ) ; let _ = self . min . fetch_update ( Ordering :: SeqCst , Ordering :: SeqCst , | min | { if val < min { Some ( val ) } else { None } } ) ; self . sum . fetch_add ( val , Ordering :: SeqCst ) ; self . count . fetch_add ( 1 , Ordering :: SeqCst ) ; for idx in 0 ..= self . bounds . len ( ) { // Allocate value in the last buckets if we reached the end of the Bounds array. if idx == self . bounds . len ( ) { self . count_per_bucket [ idx ] . fetch_add ( 1 , Ordering :: SeqCst ) ; break ; } if val < ( self . bounds [ idx ] . load ( Ordering :: SeqCst ) as i64 ) { self . count_per_bucket [ idx ] . fetch_add ( 1 , Ordering :: SeqCst ) ; break ; } } }
`update` changes the Min and Max fields if value is less than or greater than the current values.
` update ` changes the Min and Max fields if value is less than or greater than the current values .
&self
val
i64
&self
val
i64