pub trait KeyValueStore {
type Error;
// Required methods
async fn load(
&self,
key: &[u8],
buf: &mut [u8],
) -> Result<Option<usize>, Self::Error>;
async fn store(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>;
async fn delete(&self, key: &[u8]) -> Result<(), Self::Error>;
}Expand description
Persistent key-value store used by higher layers for cached state.
Required Associated Types§
Required Methods§
Sourceasync fn load(
&self,
key: &[u8],
buf: &mut [u8],
) -> Result<Option<usize>, Self::Error>
async fn load( &self, key: &[u8], buf: &mut [u8], ) -> Result<Option<usize>, Self::Error>
Load a value into buf, returning the stored length when present.
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.