mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
feat(index): add IndexVec::shrink_to (#5713)
Add `IndexVec::shrink_to` to match `std::vec::Vec::shrink_to`.
This commit is contained in:
parent
e02621d2d1
commit
a362f51523
1 changed files with 6 additions and 0 deletions
|
|
@ -371,6 +371,12 @@ impl<I: Idx, T> IndexVec<I, T> {
|
|||
self.raw.shrink_to_fit();
|
||||
}
|
||||
|
||||
/// Shrinks the capacity of the vector with a lower bound.
|
||||
#[inline]
|
||||
pub fn shrink_to(&mut self, min_capacity: usize) {
|
||||
self.raw.shrink_to(min_capacity);
|
||||
}
|
||||
|
||||
/// Shortens the vector, keeping the first `len` elements and dropping
|
||||
/// the rest. See [`Vec::truncate`]
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Reference in a new issue