feat: hashmap with_capacity

This commit is contained in:
2025-05-17 20:04:12 +08:00
parent 7b55a15281
commit ec61eaa140
4 changed files with 16 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
use std::hash::Hash;
use hashbrown::{HashMap, HashSet};
use derive_more::Constructor;
@@ -22,6 +24,10 @@ impl<'vm> AttrSet<'vm> {
}
}
pub fn with_capacity(cap: usize) -> Self {
AttrSet { data: HashMap::with_capacity(cap) }
}
pub fn push_attr_force(&mut self, sym: usize, val: Value<'vm>) {
self.data.insert(sym, val);
}