MCPcopy Create free account
hub / github.com/Voxon-Development/zeta-lang / insert_vm_string

Method insert_vm_string

zeta_utilities/src/string_pool.rs:147–167  ·  view source on GitHub ↗
(&self, bytes: &[u8], hash: u64)

Source from the content-addressed store, hash-verified

145unsafe impl Send for VmString {}
146unsafe impl Sync for VmString {}
147
148type StringBucket = SmallVec<VmString, 2>;
149
150#[derive(Debug)]
151pub struct StringPool {
152 data_buffer: GrowableAtomicBump<'static>,
153
154 interned_strings: DashMap<u64, StringBucket, IdentityBuild>,
155}
156
157#[derive(Debug)]
158pub struct ThreadLocalStringPool<'a> {
159 global: &'a StringPool,
160 local_strings: HashMap<u64, StringBucket, IdentityBuild>,
161}
162
163impl StringPool {
164 #[inline]
165 pub fn new() -> Result<Self, AllocError> {
166 Ok(Self {
167 data_buffer: GrowableAtomicBump::with_capacity_and_aligned(2 * MEGABYTE, 32)?,
168
169 interned_strings: DashMap::with_hasher(IdentityBuild),
170 })

Callers 1

intern_bytesMethod · 0.80

Calls 3

expectMethod · 0.80
alloc_manyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected