Skip to content

Commit 763ace0

Browse files
authored
Add a clear method to our OOM-handling Vec (#12620)
1 parent ec39df2 commit 763ace0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

crates/core/src/alloc/vec.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ impl<T> Vec<T> {
288288
// use `std`'s `into_boxed_slice` without fear of `realloc`.
289289
Ok(self.inner.into_boxed_slice())
290290
}
291+
292+
/// Same as [`std::vec::Vec::clear`].
293+
pub fn clear(&mut self) {
294+
self.inner.clear();
295+
}
291296
}
292297

293298
impl<T> Deref for Vec<T> {

0 commit comments

Comments
 (0)