#[repr(C)]pub struct TypedMap<K, V> {
pub header: HeapHeader,
pub buckets: *mut Bucket<K, V>,
pub bucket_count: u32,
pub len: u32,
pub tombstone_count: u32,
pub _pad: u32,
}Expand description
Typed open-addressing hash map with linear probing.
Fields§
§header: HeapHeader§buckets: *mut Bucket<K, V>Pointer to bucket array.
bucket_count: u32Number of buckets (always a power of 2).
len: u32Number of live entries.
tombstone_count: u32Number of tombstones.
_pad: u32Implementations§
Source§impl<K: Copy, V: Copy> TypedMap<K, V>
impl<K: Copy, V: Copy> TypedMap<K, V>
Source§impl<V: Copy> TypedMap<*const u8, V>
impl<V: Copy> TypedMap<*const u8, V>
Sourcepub unsafe fn insert(
this: *mut Self,
key: *const StringObj,
value: V,
) -> Option<V>
pub unsafe fn insert( this: *mut Self, key: *const StringObj, value: V, ) -> Option<V>
Insert a key-value pair. If the key already exists, updates the value and returns the old value.
The map retains the key pointer (caller must ensure it stays alive via refcounting). If the key already exists, the existing key pointer is kept.
§Safety
this must point to a valid TypedMap. key must point to a valid StringObj.
Sourcepub unsafe fn get(this: *const Self, key: *const StringObj) -> Option<V>
pub unsafe fn get(this: *const Self, key: *const StringObj) -> Option<V>
Look up a value by string key.
§Safety
this must point to a valid TypedMap. key must point to a valid StringObj.
Source§impl<V: Copy> TypedMap<i64, V>
impl<V: Copy> TypedMap<i64, V>
Sourcepub unsafe fn insert_i64(this: *mut Self, key: i64, value: V) -> Option<V>
pub unsafe fn insert_i64(this: *mut Self, key: i64, value: V) -> Option<V>
Insert a key-value pair. If the key already exists, updates the value and returns the old value.
§Safety
this must point to a valid TypedMap<i64, V>.
Sourcepub unsafe fn contains_key_i64(this: *const Self, key: i64) -> bool
pub unsafe fn contains_key_i64(this: *const Self, key: i64) -> bool
Auto Trait Implementations§
impl<K, V> !Freeze for TypedMap<K, V>
impl<K, V> RefUnwindSafe for TypedMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> !Send for TypedMap<K, V>
impl<K, V> !Sync for TypedMap<K, V>
impl<K, V> Unpin for TypedMap<K, V>
impl<K, V> UnsafeUnpin for TypedMap<K, V>
impl<K, V> UnwindSafe for TypedMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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