diff options
author | Jonas Schievink <[email protected]> | 2020-06-24 15:14:58 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-06-24 15:54:21 +0100 |
commit | d4ddec2bdfc0766782a662b87e1456a9041e8182 (patch) | |
tree | 1e7e758e14b609fcec6aae19bd5001290286ec47 /crates/ra_arena/src | |
parent | 94169ee504bf1a5e59530c1ab1f5f5550ae45914 (diff) |
Shrink arenas after building ItemTree
Diffstat (limited to 'crates/ra_arena/src')
-rw-r--r-- | crates/ra_arena/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_arena/src/lib.rs b/crates/ra_arena/src/lib.rs index 441fbb3cb..3169aa5b8 100644 --- a/crates/ra_arena/src/lib.rs +++ b/crates/ra_arena/src/lib.rs | |||
@@ -116,6 +116,9 @@ impl<T> Arena<T> { | |||
116 | ) -> impl Iterator<Item = (Idx<T>, &T)> + ExactSizeIterator + DoubleEndedIterator { | 116 | ) -> impl Iterator<Item = (Idx<T>, &T)> + ExactSizeIterator + DoubleEndedIterator { |
117 | self.data.iter().enumerate().map(|(idx, value)| (Idx::from_raw(RawId(idx as u32)), value)) | 117 | self.data.iter().enumerate().map(|(idx, value)| (Idx::from_raw(RawId(idx as u32)), value)) |
118 | } | 118 | } |
119 | pub fn shrink_to_fit(&mut self) { | ||
120 | self.data.shrink_to_fit(); | ||
121 | } | ||
119 | } | 122 | } |
120 | 123 | ||
121 | impl<T> Default for Arena<T> { | 124 | impl<T> Default for Arena<T> { |