f optimize

This commit is contained in:
John Spray
2024-07-20 20:51:43 +01:00
parent a9cff1e881
commit f534793707
+9
View File
@@ -42,6 +42,10 @@ impl<K: Ord, V> VecMap<K, V> {
}
}
pub fn len(&self) -> usize {
self.data.len()
}
pub fn with_capacity(capacity: usize, ordering: VecMapOrdering) -> Self {
Self {
data: Vec::with_capacity(capacity),
@@ -119,6 +123,11 @@ impl<K: Ord, V> VecMap<K, V> {
Ok((None, delta_size))
}
/// Where the key is known to be unique, and we don't want any instrumentation
pub fn append2(&mut self, key: K, value: V) {
self.data.push((key, value));
}
/// Split the map into two.
///
/// The left map contains everything before `cutoff` (exclusive).