| 159 | /// Capacity will be `>= self.len() + additional`. |
| 160 | #[inline] |
| 161 | pub fn reserve(&mut self, additional: usize) { |
| 162 | let capacity = self.len + additional; |
| 163 | if capacity > self.capacity() { |
| 164 | // convert differential to bytes |
| 165 | let additional = bit_util::ceil(capacity, 8) - self.buffer.len(); |
| 166 | self.buffer.reserve(additional); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | /// Resizes the buffer, either truncating its contents (with no change in capacity), or |
| 171 | /// growing it (potentially reallocating it) and writing `false` in the newly available bits. |