pub struct HashIndex<K: Hash + Eq, V: Copy> { /* private fields */ }Expand description
A concurrent hash index for fast key lookups.
This index provides O(1) average-case lookup, insertion, and deletion.
Implementations§
Source§impl<K: Hash + Eq, V: Copy> HashIndex<K, V>
impl<K: Hash + Eq, V: Copy> HashIndex<K, V>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new hash index with the given capacity.
Sourcepub fn insert(&self, key: K, value: V) -> Option<V>
pub fn insert(&self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the index.
Returns the previous value if the key was already present.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !Freeze for HashIndex<K, V>
impl<K, V> !RefUnwindSafe for HashIndex<K, V>
impl<K, V> Send for HashIndex<K, V>
impl<K, V> Sync for HashIndex<K, V>
impl<K, V> Unpin for HashIndex<K, V>
impl<K, V> UnwindSafe for HashIndex<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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