| 279 | // exits. |
| 280 | #[inline(always)] |
| 281 | pub fn reserve(&mut self, additional: usize) { |
| 282 | let required_cap = self |
| 283 | .len |
| 284 | .checked_add(additional) |
| 285 | .expect("buffer length overflow"); |
| 286 | if required_cap > self.layout.size() { |
| 287 | let new_capacity = bit_util::round_upto_multiple_of_64(required_cap); |
| 288 | let new_capacity = std::cmp::max(new_capacity, self.layout.size() * 2); |
| 289 | self.reallocate(new_capacity) |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | /// Adding to this mutable buffer `slice_to_repeat` repeated `repeat_count` times. |
| 294 | /// |