(&mut self, new_len: usize)
| 170 | } |
| 171 | |
| 172 | pub fn truncate(&mut self, new_len: usize) { |
| 173 | unsafe { |
| 174 | if new_len < self.len() { |
| 175 | let tail: *mut [_] = &mut self[new_len..]; |
| 176 | self.len = new_len; |
| 177 | ptr::drop_in_place(tail); |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /// Remove all elements in the vector. |
| 183 | pub fn clear(&mut self) { |
no test coverage detected