pub trait KVStore<K: U64 = u64, V: Serialize + DeserializeOwned + Clone = Properties>: Clone {
// Required methods
fn new(name: Option<&str>) -> Self;
fn len(&self) -> u64;
fn is_empty(&self) -> bool;
fn get(&self, key: K) -> Option<&V>;
fn get_mut(&mut self, key: K) -> Option<&mut V>;
fn set(&mut self, key: K, value: V);
fn has(&self, key: K) -> bool;
fn iter<'a>(&'a self) -> impl Iterator<Item = (&'a K, &'a V)>
where K: 'a,
V: 'a;
fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = (&'a K, &'a mut V)>
where K: 'a,
V: 'a;
// Provided method
fn cleanup(&mut self) { ... }
}Expand description
Represents a key-value store
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.