Trait yrs::types::map::Map

source ·
pub trait Map: AsRef<Branch> {
    // 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<Rc<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::Returnwhere K: Into<Rc<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.

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.

Implementors§