Trait yrs::types::map::Map

source ·
pub trait Map: AsRef<Branch> + Sized {
    // Provided methods
    fn len<T: ReadTxn>(&self, _txn: &T) -> u32 { ... }
    fn keys<'a, T: ReadTxn + 'a>(&'a self, txn: &'a T) -> Keys<'a, &'a T, T>  { ... }
    fn values<'a, T: ReadTxn + 'a>(&'a self, txn: &'a T) -> Values<'a, &'a T, T>  { ... }
    fn iter<'a, T: ReadTxn + 'a>(&'a self, txn: &'a T) -> MapIter<'a, &'a T, T>  { ... }
    fn insert<K, V>(
        &self,
        txn: &mut TransactionMut<'_>,
        key: K,
        value: V
    ) -> V::Return
       where K: Into<Arc<str>>,
             V: Prelim { ... }
    fn remove(&self, txn: &mut TransactionMut<'_>, key: &str) -> Option<Value> { ... }
    fn get<T: ReadTxn>(&self, txn: &T, key: &str) -> Option<Value> { ... }
    fn contains_key<T: ReadTxn>(&self, _txn: &T, key: &str) -> bool { ... }
    fn clear(&self, txn: &mut TransactionMut<'_>) { ... }
}

Provided Methods§

source

fn len<T: ReadTxn>(&self, _txn: &T) -> u32

Returns a number of entries stored within current map.

source

fn keys<'a, T: ReadTxn + 'a>(&'a self, txn: &'a T) -> Keys<'a, &'a T, T>

Returns an iterator that enables to traverse over all keys of entries stored within current map. These keys are not ordered.

source

fn values<'a, T: ReadTxn + 'a>(&'a self, txn: &'a T) -> Values<'a, &'a T, T>

Returns an iterator that enables to traverse over all values stored within current map.

source

fn iter<'a, T: ReadTxn + 'a>(&'a self, txn: &'a T) -> MapIter<'a, &'a T, T>

Returns an iterator that enables to traverse over all entries - tuple of key-value pairs - stored within current map.

source

fn insert<K, V>( &self, txn: &mut TransactionMut<'_>, key: K, value: V ) -> V::Return
where K: Into<Arc<str>>, V: Prelim,

Inserts a new value under given key into current map. Returns an integrated value.

source

fn remove(&self, txn: &mut TransactionMut<'_>, key: &str) -> Option<Value>

Removes a stored within current map under a given key. Returns that value or None if no entry with a given key was present in current map.

§Removing nested shared types

In case when a nested shared type (eg. MapRef, ArrayRef, TextRef) is being removed, all of its contents will also be deleted recursively. A returned value will contain a reference to a current removed shared type (which will be empty due to all of its elements being deleted), not the content prior the removal.

source

fn get<T: ReadTxn>(&self, txn: &T, key: &str) -> Option<Value>

Returns a value stored under a given key within current map, or None if no entry with such key existed.

source

fn contains_key<T: ReadTxn>(&self, _txn: &T, key: &str) -> bool

Checks if an entry with given key can be found within current map.

source

fn clear(&self, txn: &mut TransactionMut<'_>)

Clears the contents of current map, effectively removing all of its entries.

Object Safety§

This trait is not object safe.

Implementors§