pub trait CacheKey<T: Transformer> {
// Required methods
fn to_id(&self) -> <T as Identifiable>::Id;
fn to_cache_id(&self) -> <T as CachePolicy>::CacheId;
// Provided methods
fn eq_key(&self, cache_id: &<T as CachePolicy>::CacheId) -> bool { ... }
fn hash_cache<H: Hasher>(&self, state: &mut H) { ... }
fn eq_id(&self, id: &<T as Identifiable>::Id) -> bool { ... }
}Expand description
Allows effecient cache lookups with minimal cloning
This is similar to the Equivalent trait
Default implementations have been provided and should be overridden if either to_cache_id() or to_id() are costly
Required Methods§
Sourcefn to_id(&self) -> <T as Identifiable>::Id
fn to_id(&self) -> <T as Identifiable>::Id
Makes an Id
Sourcefn to_cache_id(&self) -> <T as CachePolicy>::CacheId
fn to_cache_id(&self) -> <T as CachePolicy>::CacheId
Makes a CacheId
Provided Methods§
Sourcefn eq_key(&self, cache_id: &<T as CachePolicy>::CacheId) -> bool
fn eq_key(&self, cache_id: &<T as CachePolicy>::CacheId) -> bool
Determines if this is equivalent to the CacheId
Sourcefn hash_cache<H: Hasher>(&self, state: &mut H)
fn hash_cache<H: Hasher>(&self, state: &mut H)
Used for hashing the key
fn eq_id(&self, id: &<T as Identifiable>::Id) -> bool
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.