pub trait Readable {
// Required methods
fn read<T, R>(&self, col: u32, key: &dyn Key<T, Target = R>) -> Option<T>
where T: Decodable,
R: Deref<Target = [u8]>;
fn exists<T, R>(&self, col: u32, key: &dyn Key<T, Target = R>) -> bool
where R: Deref<Target = [u8]>;
// Provided methods
fn read_with_cache<K, T, C>(
&self,
col: u32,
cache: &RwLock<C>,
key: &K,
) -> Option<T>
where K: Key<T> + Eq + Hash + Clone,
T: Clone + Decodable,
C: Cache<K, T> { ... }
fn exists_with_cache<K, T, R, C>(
&self,
col: u32,
cache: &RwLock<C>,
key: &K,
) -> bool
where K: Eq + Hash + Key<T, Target = R>,
R: Deref<Target = [u8]>,
C: Cache<K, T> { ... }
}
Expand description
Should be used to read values from database.
Required Methods§
Provided Methods§
Sourcefn read_with_cache<K, T, C>(
&self,
col: u32,
cache: &RwLock<C>,
key: &K,
) -> Option<T>
fn read_with_cache<K, T, C>( &self, col: u32, cache: &RwLock<C>, key: &K, ) -> Option<T>
Returns value for given key either in cache or in database.
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.