pub trait PlainDB<K, V>: Send + Sync + AsPlainDB<K, V> {
fn get(&self, key: &K) -> Option<V>;
fn contains(&self, key: &K) -> bool;
fn emplace(&mut self, key: K, value: V);
fn remove(&mut self, key: &K);
}
Expand description
Trait modelling a plain datastore whose key is a fixed type. The caller should ensure that a key only corresponds to one value.
Required methods
Look up a given hash into the bytes that hash to it, returning None if the hash is not known.
Insert a datum item into the DB. Insertions are counted and the equivalent
number of remove()
s must be performed before the data is considered dead.
The caller should ensure that a key only corresponds to one value.
Remove a datum previously inserted. Insertions can be “owed” such that the
same number of insert()
s may happen without the data being eventually
being inserted into the DB. It can be “owed” more than once.
The caller should ensure that a key only corresponds to one value.
Trait Implementations
sourceimpl<'a, K, V> AsPlainDB<K, V> for &'a mut dyn PlainDB<K, V>
impl<'a, K, V> AsPlainDB<K, V> for &'a mut dyn PlainDB<K, V>
sourcefn as_plain_db(&self) -> &dyn PlainDB<K, V>
fn as_plain_db(&self) -> &dyn PlainDB<K, V>
Perform upcast to PlainDB for anything that derives from PlainDB.
sourcefn as_plain_db_mut<'b>(&'b mut self) -> &'b mut (dyn PlainDB<K, V> + 'b)
fn as_plain_db_mut<'b>(&'b mut self) -> &'b mut (dyn PlainDB<K, V> + 'b)
Perform mutable upcast to PlainDB for anything that derives from PlainDB.