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>

source§

fn clone(&self) -> MemoryMap<K, V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
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>

§

type Target = Arc<RwLock<RawRwLock, BTreeMap<Vec<u8>, V>>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
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>

source§

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>

source§

fn insert(&self, key: K, value: V) -> Result<()>

Inserts the given key-value pair into the map.

source§

fn remove(&self, key: &K) -> Result<()>

Removes the key-value pair for the given key from the map.

source§

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

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)

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)

Removes the latest atomic checkpoint.

source§

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)

Aborts the current atomic operation.

source§

fn finish_atomic(&self) -> Result<()>

Finishes an atomic operation, performing all the queued writes.

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>

source§

fn contains_key_confirmed<Q>(&self, key: &Q) -> Result<bool>where K: Borrow<Q>, Q: PartialEq + Eq + Hash + Serialize + ?Sized,

Returns true if the given key exists in the map.

source§

fn contains_key_speculative<Q>(&self, key: &Q) -> Result<bool>where K: Borrow<Q>, Q: PartialEq + Eq + Hash + Serialize + ?Sized,

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>>>where K: Borrow<Q>, Q: PartialEq + Eq + Hash + Serialize + ?Sized,

Returns the value for the given key from the map, if it exists.

source§

fn get_pending<Q>(&self, key: &Q) -> Option<Option<V>>where K: Borrow<Q>, Q: PartialEq + Eq + Hash + Serialize + ?Sized,

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

Returns an iterator visiting each key-value pair in the atomic batch.

source§

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

Returns an iterator over each key in the map.

source§

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 get_speculative<Q>(&'a self, key: &Q) -> Result<Option<Cow<'a, V>>>where K: Borrow<Q>, Q: PartialEq + Eq + Hash + Serialize + ?Sized,

Returns the value for the given key from the atomic batch first, if it exists, or return from the map, otherwise.

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V