]> git.lizzy.rs Git - rust.git/commitdiff
Add resize() method to IndexVec.
authorMichael Woerister <michaelwoerister@posteo.net>
Tue, 14 Mar 2017 14:49:28 +0000 (15:49 +0100)
committerMichael Woerister <michaelwoerister@posteo.net>
Wed, 22 Mar 2017 15:11:18 +0000 (16:11 +0100)
src/librustc_data_structures/indexed_vec.rs

index 3f478d7c165d13b1b903e35e0f72f2b53678d5d6..62c430dda327fe1c48c4a9537c50daecbd87ecce 100644 (file)
@@ -189,6 +189,13 @@ pub fn get_mut(&mut self, index: I) -> Option<&mut T> {
     }
 }
 
+impl<I: Idx, T: Clone> IndexVec<I, T> {
+    #[inline]
+    pub fn resize(&mut self, new_len: usize, value: T) {
+        self.raw.resize(new_len, value)
+    }
+}
+
 impl<I: Idx, T> Index<I> for IndexVec<I, T> {
     type Output = T;