Like `reserve_exact` but returns an error on allocation failure.
(&mut self, additional: usize)
| 175 | |
| 176 | /// Like `reserve_exact` but returns an error on allocation failure. |
| 177 | pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), OutOfMemory> { |
| 178 | self.elems |
| 179 | .try_reserve_exact(additional) |
| 180 | .map_err(|_| OutOfMemory::new(self.len().saturating_add(additional))) |
| 181 | } |
| 182 | |
| 183 | /// Shrinks the capacity of the `PrimaryMap` as much as possible. |
| 184 | pub fn shrink_to_fit(&mut self) { |