Struct redb::MultimapTable
source · pub struct MultimapTable<'db, 'txn, K: RedbKey + ?Sized + 'txn, V: RedbKey + ?Sized + 'txn> { /* private fields */ }
Expand description
A multimap table
Multimap tables may have multiple values associated with each key
Implementations§
source§impl<'db, 'txn, K: RedbKey + ?Sized + 'txn, V: RedbKey + ?Sized + 'txn> MultimapTable<'db, 'txn, K, V>
impl<'db, 'txn, K: RedbKey + ?Sized + 'txn, V: RedbKey + ?Sized + 'txn> MultimapTable<'db, 'txn, K, V>
sourcepub fn insert<'a, 'b: 'a>(
&mut self,
key: &'a impl Borrow<K::RefBaseType<'b>> + ?Sized,
value: &'a impl Borrow<V::RefBaseType<'a>> + ?Sized
) -> Result<bool, Error>where
K: 'b,
V: 'b,
pub fn insert<'a, 'b: 'a>(
&mut self,
key: &'a impl Borrow<K::RefBaseType<'b>> + ?Sized,
value: &'a impl Borrow<V::RefBaseType<'a>> + ?Sized
) -> Result<bool, Error>where
K: 'b,
V: 'b,
Add the given value to the mapping of the key
Returns true
if the key-value pair was present
sourcepub fn remove(
&mut self,
key: &K::RefBaseType<'_>,
value: &V::RefBaseType<'_>
) -> Result<bool, Error>
pub fn remove(
&mut self,
key: &K::RefBaseType<'_>,
value: &V::RefBaseType<'_>
) -> Result<bool, Error>
Removes the given key-value pair
Returns true
if the key-value pair was present
sourcepub fn remove_all(
&mut self,
key: &K::RefBaseType<'_>
) -> Result<MultimapValueIter<'_, V>, Error>
pub fn remove_all(
&mut self,
key: &K::RefBaseType<'_>
) -> Result<MultimapValueIter<'_, V>, Error>
Removes all values for the given key
Returns an iterator over the removed values. Values are in ascending order.
Trait Implementations§
source§impl<'db, 'txn, K: RedbKey + ?Sized, V: RedbKey + ?Sized> Drop for MultimapTable<'db, 'txn, K, V>
impl<'db, 'txn, K: RedbKey + ?Sized, V: RedbKey + ?Sized> Drop for MultimapTable<'db, 'txn, K, V>
source§impl<'db, 'txn, K: RedbKey + ?Sized, V: RedbKey + ?Sized> ReadableMultimapTable<K, V> for MultimapTable<'db, 'txn, K, V>
impl<'db, 'txn, K: RedbKey + ?Sized, V: RedbKey + ?Sized> ReadableMultimapTable<K, V> for MultimapTable<'db, 'txn, K, V>
source§fn get<'a>(
&'a self,
key: impl Borrow<K::RefBaseType<'a>>
) -> Result<MultimapValueIter<'a, V>, Error>
fn get<'a>(
&'a self,
key: impl Borrow<K::RefBaseType<'a>>
) -> Result<MultimapValueIter<'a, V>, Error>
Returns an iterator over all values for the given key. Values are in ascending order.
source§fn range<'a, T: RangeBounds<&'a K::RefBaseType<'a>> + 'a>(
&'a self,
range: T
) -> Result<MultimapRangeIter<'a, K, V>, Error>
fn range<'a, T: RangeBounds<&'a K::RefBaseType<'a>> + 'a>(
&'a self,
range: T
) -> Result<MultimapRangeIter<'a, K, V>, Error>
Returns a double-ended iterator over a range of elements in the table