pub struct KvMap<K: Copy + Eq + Send + Sync + 'static, V: Copy + Send + Sync + 'static> { /* private fields */ }Expand description
Key-value lookup map, backed by SharedHashMap. Multiple
processes can insert + look up concurrently via the shared MMF.
The dispatcher confirms SharedHashMap is the right family;
if a different family is picked, the constructor returns
ApiError::WrongFamily.
Implementations§
Source§impl<K, V> KvMap<K, V>
impl<K, V> KvMap<K, V>
Sourcepub fn create(
path: impl AsRef<Path>,
shape: MmfWorkloadShape,
capacity: usize,
) -> Result<Self, ApiError>
pub fn create( path: impl AsRef<Path>, shape: MmfWorkloadShape, capacity: usize, ) -> Result<Self, ApiError>
Create the map at path with the given workload shape.
capacity is rounded up to next pow2.
Sourcepub fn insert(&self, key: K, value: V) -> Result<InsertOutcome, ApiError>
pub fn insert(&self, key: K, value: V) -> Result<InsertOutcome, ApiError>
Insert a key-value pair.
Auto Trait Implementations§
impl<K, V> Freeze for KvMap<K, V>
impl<K, V> RefUnwindSafe for KvMap<K, V>
impl<K, V> Send for KvMap<K, V>
impl<K, V> Sync for KvMap<K, V>
impl<K, V> Unpin for KvMap<K, V>
impl<K, V> UnsafeUnpin for KvMap<K, V>
impl<K, V> UnwindSafe for KvMap<K, V>
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