InMemoryDb

Struct InMemoryDb 

Source
pub struct InMemoryDb<K: Key, V: Value> { /* private fields */ }

Trait Implementations§

Source§

impl<K: Key + Clone, V: Value + Clone> DbOp<K, V> for InMemoryDb<K, V>

Source§

fn open_tree(&mut self, tree_name: &str) -> Option<bool>

return true if the tree has to be opened

Source§

fn get_current_tree(&self) -> Option<String>

Source§

fn tree_names(&self) -> Vec<String>

Source§

fn drop_tree(&mut self, tree_name: &str) -> bool

Source§

fn clear_tree(&mut self, tree_name: &str) -> bool

Source§

fn merge_trees( &mut self, tree_name_source: &str, tree_name_dest: &str, ) -> Option<()>

Source§

fn merge_current_tree_with(&mut self, tree_name_source: &str) -> Option<()>

Source§

fn apply_batch(&mut self, batch: Batch<K, V>) -> Option<()>

Source§

fn apply_tree( &mut self, tree_name: &str, consumer: &mut impl FnMut(&mut Tree<K, V>) -> Option<V>, ) -> Option<V>

Source§

fn flush(&self) -> Result<&'static str>

Source§

fn open_tree_and_apply( &mut self, tree_name: &str, consumer: &mut impl FnMut(&mut Tree<K, V>) -> Option<V>, ) -> Option<V>

Source§

impl<K: Debug + Key, V: Debug + Value> Debug for InMemoryDb<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: Key + Clone, V: Value + Clone> Default for InMemoryDb<K, V>

Source§

fn default() -> InMemoryDb<K, V>

Returns the “default value” for a type. Read more
Source§

impl<'de, K, V> Deserialize<'de> for InMemoryDb<K, V>
where K: Deserialize<'de> + Key, V: Deserialize<'de> + Value,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<K: Key + Clone, V: Value> Op<K, V> for InMemoryDb<K, V>

Source§

fn read(&self, k: impl Into<K>, r: impl Fn(&V) -> Option<V>) -> Option<V>

Source§

fn insert(&mut self, k: impl Into<K>, v: impl Into<V>) -> Option<V>

Source§

fn remove(&mut self, k: impl Into<K>) -> Option<V>

Source§

fn clear(&mut self)

Source§

fn contains(&self, k: &K) -> Option<bool>

Source§

fn len(&self) -> Option<usize>

Source§

fn keys(&self) -> Vec<K>

Source§

fn list_all(&self) -> BTreeMap<K, V>

Source§

fn get_value(&self, k: impl Into<K>) -> Option<V>

Source§

fn read_no_op(&self, k: impl Into<K>, r: impl Fn(&V) -> Option<V>) -> Option<V>

Source§

fn is_empty(&self) -> bool

Source§

impl<K, V> Serialize for InMemoryDb<K, V>
where K: Serialize + Key, V: Serialize + Value,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<K, V> Freeze for InMemoryDb<K, V>

§

impl<K, V> RefUnwindSafe for InMemoryDb<K, V>

§

impl<K, V> Send for InMemoryDb<K, V>

§

impl<K, V> Sync for InMemoryDb<K, V>

§

impl<K, V> Unpin for InMemoryDb<K, V>

§

impl<K, V> UnwindSafe for InMemoryDb<K, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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.

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,