diff --git a/lib/entity/src/primary.rs b/lib/entity/src/primary.rs index 7a45fa9582..8f1daed7e3 100644 --- a/lib/entity/src/primary.rs +++ b/lib/entity/src/primary.rs @@ -135,6 +135,11 @@ where self.elems.reserve_exact(additional) } + /// Shrinks the capacity of the `PrimaryMap` as much as possible. + pub fn shrink_to_fit(&mut self) { + self.elems.shrink_to_fit() + } + /// Consumes this `PrimaryMap` and produces a `BoxedSlice`. pub fn into_boxed_slice(self) -> BoxedSlice { unsafe { BoxedSlice::::from_raw(Box::<[V]>::into_raw(self.elems.into_boxed_slice())) }