Frees `capacity` bytes from this reservation # Panics Panics if `capacity` exceeds [`Self::size`]
(&self, capacity: usize)
| 402 | /// |
| 403 | /// Panics if `capacity` exceeds [`Self::size`] |
| 404 | pub fn shrink(&self, capacity: usize) { |
| 405 | self.size |
| 406 | .fetch_update( |
| 407 | atomic::Ordering::Relaxed, |
| 408 | atomic::Ordering::Relaxed, |
| 409 | |prev| prev.checked_sub(capacity), |
| 410 | ) |
| 411 | .unwrap_or_else(|prev| { |
| 412 | panic!("Cannot free the capacity {capacity} out of allocated size {prev}") |
| 413 | }); |
| 414 | self.registration.pool.shrink(self, capacity); |
| 415 | } |
| 416 | |
| 417 | /// Tries to free `capacity` bytes from this reservation |
| 418 | /// if `capacity` does not exceed [`Self::size`]. |
no outgoing calls
no test coverage detected