pub struct HashMapData {
pub keys: Vec<ValueWord>,
pub values: Vec<ValueWord>,
pub index: HashMap<u64, Vec<usize>>,
pub shape_id: Option<ShapeId>,
}Expand description
Data for HashMap variant (boxed to keep HeapValue small).
Uses bucket chaining (HashMap<u64, Vec<usize>>) so that hash collisions
are handled correctly — each bucket stores all indices whose key hashes
to the same u64.
Fields§
§keys: Vec<ValueWord>§values: Vec<ValueWord>§index: HashMap<u64, Vec<usize>>§shape_id: Option<ShapeId>Optional shape (hidden class) for O(1) index-based access. None means “dictionary mode” (fallback to hash-based lookup).
Implementations§
Source§impl HashMapData
impl HashMapData
Sourcepub fn find_key(&self, key: &ValueWord) -> Option<usize>
pub fn find_key(&self, key: &ValueWord) -> Option<usize>
Look up the index of key in this HashMap, returning Some(idx) if found.
Sourcepub fn rebuild_index(keys: &[ValueWord]) -> HashMap<u64, Vec<usize>>
pub fn rebuild_index(keys: &[ValueWord]) -> HashMap<u64, Vec<usize>>
Build a bucketed index from the keys vector.
Sourcepub fn compute_shape(keys: &[ValueWord]) -> Option<ShapeId>
pub fn compute_shape(keys: &[ValueWord]) -> Option<ShapeId>
Compute a ShapeId for this HashMap if all keys are strings and count <= 64.
Returns None (dictionary mode) if any key is non-string or there are
more than 64 properties.
Trait Implementations§
Source§impl Clone for HashMapData
impl Clone for HashMapData
Source§fn clone(&self) -> HashMapData
fn clone(&self) -> HashMapData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HashMapData
impl RefUnwindSafe for HashMapData
impl Send for HashMapData
impl Sync for HashMapData
impl Unpin for HashMapData
impl UnsafeUnpin for HashMapData
impl UnwindSafe for HashMapData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more