fn purge(&mut self, key: &u64) {
        if self.count > 0 && !self.all_items_in_excess() {
            if key == &self.min {
                let start = self.min + 1; // min just got removed
                for key in start..self.max {
                    if self.contains_assume_in_range(&key) {
                        self.min = key;
                        break;
                    }
                }
            }
        } else {
            // The idea is that there are no items in the bitfield anymore.
            // But, there MAY be items in excess. The model works such that items < min go into excess.
            // So, after purging all items from bitfield, we hold max to be what it previously was, but set min to max.
            // Thus, if we lookup >= max, answer is always false without having to look in excess.
            // If we changed max here to 0, we would lose the ability to know the range of items in excess (if any).
            // So, now, with min updated = max:
            // If we lookup < max, then we first check min.
            // If >= min, then we look in bitfield.
            // Otherwise, we look in excess since the request is < min.
            // So, resetting min like this after a remove results in the correct behavior for the model.
            // Later, if we insert and there are 0 items total (excess + bitfield), then we reset min/max to reflect the new item only.
            self.min = self.max;
        }
    }
// after removing 'key' where 'key' = min, make min the correct new min value
after removing 'key' where 'key' = min, make min the correct new min value
after removing ' key ' where ' key ' = min make min the correct new min value
fn purge(&mut self, key: &u64) {
        if self.count > 0 && !self.all_items_in_excess() {
            if key == &self.min {
                let start = self.min + 1; // min just got removed
                for key in start..self.max {
                    if self.contains_assume_in_range(&key) {
                        self.min = key;
                        break;
                    }
                }
            }
        } else {
            // The idea is that there are no items in the bitfield anymore.
            // But, there MAY be items in excess. The model works such that items < min go into excess.
            // So, after purging all items from bitfield, we hold max to be what it previously was, but set min to max.
            // Thus, if we lookup >= max, answer is always false without having to look in excess.
            // If we changed max here to 0, we would lose the ability to know the range of items in excess (if any).
            // So, now, with min updated = max:
            // If we lookup < max, then we first check min.
            // If >= min, then we look in bitfield.
            // Otherwise, we look in excess since the request is < min.
            // So, resetting min like this after a remove results in the correct behavior for the model.
            // Later, if we insert and there are 0 items total (excess + bitfield), then we reset min/max to reflect the new item only.
            self.min = self.max;
        }
    }
fn purge ( & mut self , key : & u64 ) { if self . count > 0 && ! self . all_items_in_excess ( ) { if key == & self . min { let start = self . min + 1 ; // min just got removed for key in start .. self . max { if self . contains_assume_in_range ( & key ) { self . min = key ; break ; } } } } else { // The idea is that there are no items in the bitfield anymore. // But, there MAY be items in excess. The model works such that items < min go into excess. // So, after purging all items from bitfield, we hold max to be what it previously was, but set min to max. // Thus, if we lookup >= max, answer is always false without having to look in excess. // If we changed max here to 0, we would lose the ability to know the range of items in excess (if any). // So, now, with min updated = max: // If we lookup < max, then we first check min. // If >= min, then we look in bitfield. // Otherwise, we look in excess since the request is < min. // So, resetting min like this after a remove results in the correct behavior for the model. // Later, if we insert and there are 0 items total (excess + bitfield), then we reset min/max to reflect the new item only. self . min = self . max ; } }
after removing 'key' where 'key' = min, make min the correct new min value
after removing ' key ' where ' key ' = min make min the correct new min value
&mut self
key
&u64
&mut self
key
&u64