feat(index): add IndexVec::shrink_to (#5713)

Add `IndexVec::shrink_to` to match `std::vec::Vec::shrink_to`.
This commit is contained in:
overlookmotel 2024-09-11 22:57:58 +00:00
parent e02621d2d1
commit a362f51523

View file

@ -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]