pub trait Storage<K, V>: Send + Sync {
// Required methods
fn store(&mut self, key: K, value: V) -> StorageResult<()>;
fn clear(&mut self) -> StorageResult<()>;
fn get(&self, key: &K) -> StorageResult<Option<V>>;
fn take(&mut self, key: &K) -> StorageResult<Option<V>>;
fn keys(&self) -> StorageResult<Vec<K>>;
fn into_iter(&self) -> StorageResult<Box<dyn Iterator<Item = (K, V)> + '_>>;
fn count(&self) -> StorageResult<u64>;
fn clone_box(&self) -> Box<dyn Storage<K, V>>;
// Provided methods
fn contains_key(&self, key: &K) -> StorageResult<bool> { ... }
fn shutdown(&self) { ... }
}Required Methods§
fn store(&mut self, key: K, value: V) -> StorageResult<()>
fn clear(&mut self) -> StorageResult<()>
fn get(&self, key: &K) -> StorageResult<Option<V>>
fn take(&mut self, key: &K) -> StorageResult<Option<V>>
fn keys(&self) -> StorageResult<Vec<K>>
fn into_iter(&self) -> StorageResult<Box<dyn Iterator<Item = (K, V)> + '_>>
Sourcefn count(&self) -> StorageResult<u64>
fn count(&self) -> StorageResult<u64>
Returns the number of entries in the storage.