Implement reserve and reserve_exact for PrimaryMap.

This commit is contained in:
Dan Gohman
2018-11-19 07:04:38 -06:00
parent c17579e7ec
commit 367f3cd5d3

View File

@@ -111,6 +111,16 @@ where
pub fn last(&self) -> Option<&V> {
self.elems.last()
}
/// Reserves capacity for at least `additional` more elements to be inserted.
pub fn reserve(&mut self, additional: usize) {
self.elems.reserve(additional)
}
/// Reserves the minimum capacity for exactly `additional` more elements to be inserted.
pub fn reserve_exact(&mut self, additional: usize) {
self.elems.reserve_exact(additional)
}
}
/// Immutable indexing into an `PrimaryMap`.