From f53479370702a3ad7f3470c2e29f5efa396786ae Mon Sep 17 00:00:00 2001 From: John Spray Date: Sat, 20 Jul 2024 20:51:43 +0100 Subject: [PATCH] f optimize --- libs/utils/src/vec_map.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/utils/src/vec_map.rs b/libs/utils/src/vec_map.rs index 18b2af14f1..8b9f8e167f 100644 --- a/libs/utils/src/vec_map.rs +++ b/libs/utils/src/vec_map.rs @@ -42,6 +42,10 @@ impl VecMap { } } + 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 VecMap { 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).