pub struct MemoryMap<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> { /* private fields */ }
Trait Implementations§
Source§impl<K: Clone + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Clone for MemoryMap<K, V>
impl<K: Clone + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Clone for MemoryMap<K, V>
Source§impl<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Default for MemoryMap<K, V>
impl<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Default for MemoryMap<K, V>
Source§impl<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Deref for MemoryMap<K, V>
impl<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Deref for MemoryMap<K, V>
Source§impl<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> FromIterator<(K, V)> for MemoryMap<K, V>
impl<K: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> FromIterator<(K, V)> for MemoryMap<K, V>
Source§fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
Initializes a new MemoryMap
from the given iterator.
Source§impl<'a, K: 'a + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Map<'a, K, V> for MemoryMap<K, V>
impl<'a, K: 'a + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Map<'a, K, V> for MemoryMap<K, V>
Source§fn insert(&self, key: K, value: V) -> Result<()>
fn insert(&self, key: K, value: V) -> Result<()>
Inserts the given key-value pair into the map.
Source§fn remove(&self, key: &K) -> Result<()>
fn remove(&self, key: &K) -> Result<()>
Removes the key-value pair for the given key from the map.
Source§fn start_atomic(&self)
fn start_atomic(&self)
Begins an atomic operation. Any further calls to insert
and remove
will be queued
without an actual write taking place until finish_atomic
is called.
Source§fn is_atomic_in_progress(&self) -> bool
fn is_atomic_in_progress(&self) -> bool
Checks whether an atomic operation is currently in progress. This can be done to ensure that lower-level operations don’t start and finish their individual atomic write batch if they are already part of a larger one.
Source§fn atomic_checkpoint(&self)
fn atomic_checkpoint(&self)
Saves the current list of pending operations, so that if atomic_rewind
is called,
we roll back all future operations, and return to the start of this checkpoint.
Source§fn clear_latest_checkpoint(&self)
fn clear_latest_checkpoint(&self)
Removes the latest atomic checkpoint.
Source§fn atomic_rewind(&self)
fn atomic_rewind(&self)
Removes all pending operations to the last atomic_checkpoint
(or to start_atomic
if no checkpoints have been created).
Source§fn abort_atomic(&self)
fn abort_atomic(&self)
Aborts the current atomic operation.
Source§fn finish_atomic(&self) -> Result<()>
fn finish_atomic(&self) -> Result<()>
Finishes an atomic operation, performing all the queued writes.
Source§fn pause_atomic_writes(&self) -> Result<()>
fn pause_atomic_writes(&self) -> Result<()>
Once called, the subsequent atomic write batches will be queued instead of being executed
at the end of their scope. unpause_atomic_writes
needs to be called in order to
restore the usual behavior.
Source§impl<'a, K: 'a + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> MapRead<'a, K, V> for MemoryMap<K, V>
impl<'a, K: 'a + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> MapRead<'a, K, V> for MemoryMap<K, V>
Source§fn len_confirmed(&self) -> usize
fn len_confirmed(&self) -> usize
Returns the number of confirmed entries in the map.
Source§fn contains_key_confirmed<Q>(&self, key: &Q) -> Result<bool>
fn contains_key_confirmed<Q>(&self, key: &Q) -> Result<bool>
Returns true
if the given key exists in the map.
Source§fn contains_key_speculative<Q>(&self, key: &Q) -> Result<bool>
fn contains_key_speculative<Q>(&self, key: &Q) -> Result<bool>
Returns true
if the given key exists in the map.
This method first checks the atomic batch, and if it does not exist, then checks the map.
Source§fn get_confirmed<Q>(&'a self, key: &Q) -> Result<Option<Cow<'a, V>>>
fn get_confirmed<Q>(&'a self, key: &Q) -> Result<Option<Cow<'a, V>>>
Returns the value for the given key from the map, if it exists.
Source§fn get_pending<Q>(&self, key: &Q) -> Option<Option<V>>
fn get_pending<Q>(&self, key: &Q) -> Option<Option<V>>
Returns the current value for the given key if it is scheduled to be inserted as part of an atomic batch.
If the key does not exist, returns None
.
If the key is removed in the batch, returns Some(None)
.
If the key is inserted in the batch, returns Some(Some(value))
.
Source§fn iter_pending(&'a self) -> Self::PendingIterator
fn iter_pending(&'a self) -> Self::PendingIterator
Returns an iterator visiting each key-value pair in the atomic batch.
Source§fn iter_confirmed(&'a self) -> Self::Iterator
fn iter_confirmed(&'a self) -> Self::Iterator
Returns an iterator visiting each key-value pair in the map.
Source§fn keys_confirmed(&'a self) -> Self::Keys
fn keys_confirmed(&'a self) -> Self::Keys
Returns an iterator over each key in the map.
Source§fn values_confirmed(&'a self) -> Self::Values
fn values_confirmed(&'a self) -> Self::Values
Returns an iterator over each value in the map.
type Iterator = Map<IntoIter<Vec<u8>, V>, fn(_: (Vec<u8>, V)) -> (Cow<'a, K>, Cow<'a, V>)>
type Keys = Map<IntoKeys<Vec<u8>, V>, fn(_: Vec<u8>) -> Cow<'a, K>>
type PendingIterator = Map<IntoIter<K, Option<V>>, fn(_: (K, Option<V>)) -> (Cow<'a, K>, Option<Cow<'a, V>>)>
type Values = Map<IntoValues<Vec<u8>, V>, fn(_: V) -> Cow<'a, V>>
Source§fn is_empty_confirmed(&self) -> bool
fn is_empty_confirmed(&self) -> bool
Auto Trait Implementations§
impl<K, V> Freeze for MemoryMap<K, V>
impl<K, V> !RefUnwindSafe for MemoryMap<K, V>
impl<K, V> Send for MemoryMap<K, V>
impl<K, V> Sync for MemoryMap<K, V>
impl<K, V> Unpin for MemoryMap<K, V>
impl<K, V> !UnwindSafe for MemoryMap<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more