pub fn clear(&mut self) {
        self.countdown_to_resize -= 1;

        // Only shrink capacity if it is less than 4
        // times the size, this is to prevent too
        // frequent shrinking.
        let cap = self.buffer.capacity();
        if self.countdown_to_resize == 0 && self.buffer.len() < cap * 4 {
            // When shrink_to goes stable use that on the following line.
            // https://github.com/rust-lang/rust/issues/56431
            self.compressed.shrink_to_fit();
            self.buffer.shrink_to_fit();
            trace!("compressed: {}", self.compressed.capacity());
            trace!("buffer: {}", self.buffer.capacity());
            self.countdown_to_resize = u8::max_value();
        }
        self.compressed.clear();
        self.internal_buffer.clear();
        self.buffer.clear();
    }
// Clear the buffer, and shrink it if it has more space
// enough to grow the length more than 4 times.
Clear the buffer, and shrink it if it has more space
enough to grow the length more than 4 times.
Clear the buffer and shrink it if it has more space enough to grow the length more than 4 times .
pub fn clear(&mut self) {
        self.countdown_to_resize -= 1;
        // Only shrink capacity if it is less than 4
        // times the size, this is to prevent too
        // frequent shrinking.
        let cap = self.buffer.capacity();
        if self.countdown_to_resize == 0 && self.buffer.len() < cap * 4 {
            // When shrink_to goes stable use that on the following line.
            // https://github.com/rust-lang/rust/issues/56431
            self.compressed.shrink_to_fit();
            self.buffer.shrink_to_fit();
            trace!("compressed: {}", self.compressed.capacity());
            trace!("buffer: {}", self.buffer.capacity());
            self.countdown_to_resize = u8::max_value();
        }
        self.compressed.clear();
        self.internal_buffer.clear();
        self.buffer.clear();
    }
pub fn clear ( & mut self ) { self . countdown_to_resize -= 1 ; // Only shrink capacity if it is less than 4 // times the size, this is to prevent too // frequent shrinking. let cap = self . buffer . capacity ( ) ; if self . countdown_to_resize == 0 && self . buffer . len ( ) < cap * 4 { // When shrink_to goes stable use that on the following line. // https://github.com/rust-lang/rust/issues/56431 self . compressed . shrink_to_fit ( ) ; self . buffer . shrink_to_fit ( ) ; trace ! ( " " self compressed capacity ( ) ) ; trace ! ( " " self buffer capacity ( ) ) ; self . countdown_to_resize = u8 :: max_value ( ) ; } self . compressed . clear ( ) ; self . internal_buffer . clear ( ) ; self . buffer . clear ( ) ; }
Clear the buffer, and shrink it if it has more space
enough to grow the length more than 4 times.
Clear the buffer and shrink it if it has more space enough to grow the length more than 4 times .
&mut self
&mut self