perf(header): improve on MemSlice usage in headers

This commit is contained in:
Sean McArthur
2017-01-26 23:49:44 -08:00
parent 1b556389c0
commit 61364d245b
14 changed files with 190 additions and 195 deletions

View File

@@ -4,9 +4,9 @@ pub struct VecMap<K, V> {
}
impl<K: PartialEq, V> VecMap<K, V> {
pub fn new() -> VecMap<K, V> {
pub fn with_capacity(cap: usize) -> VecMap<K, V> {
VecMap {
vec: Vec::new()
vec: Vec::with_capacity(cap)
}
}
@@ -43,6 +43,7 @@ impl<K: PartialEq, V> VecMap<K, V> {
}
pub fn len(&self) -> usize { self.vec.len() }
pub fn iter(&self) -> ::std::slice::Iter<(K, V)> {
self.vec.iter()
}