Like `reserve` but returns an error on allocation failure.
(&mut self, additional: usize)
| 163 | |
| 164 | /// Like `reserve` but returns an error on allocation failure. |
| 165 | pub fn try_reserve(&mut self, additional: usize) -> Result<(), OutOfMemory> { |
| 166 | self.elems |
| 167 | .try_reserve(additional) |
| 168 | .map_err(|_| OutOfMemory::new(self.len().saturating_add(additional))) |
| 169 | } |
| 170 | |
| 171 | /// Reserves the minimum capacity for exactly `additional` more elements to be inserted. |
| 172 | pub fn reserve_exact(&mut self, additional: usize) { |