pub trait BackingStore<K, V> {
// Required methods
fn store(&mut self, key: &K, value: &V) -> Result<(), StoreError>;
fn load(&self, key: &K) -> Option<V>;
fn remove(&mut self, key: &K) -> bool;
}Expand description
Abstraction over a synchronous persistent store.
Implementations are expected to be synchronous. For async I/O the caller can provide a blocking adapter.
Required Methods§
Sourcefn store(&mut self, key: &K, value: &V) -> Result<(), StoreError>
fn store(&mut self, key: &K, value: &V) -> Result<(), StoreError>
Persist (key, value) to the backing store.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".