Skip to content

Commit

Permalink
feat(index): add IndexVec::shrink_to (#5713)
Browse files Browse the repository at this point in the history
Add `IndexVec::shrink_to` to match `std::vec::Vec::shrink_to`.
  • Loading branch information
overlookmotel committed Sep 11, 2024
1 parent e02621d commit a362f51
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/oxc_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit a362f51

Please sign in to comment.