pub trait CacheDiff {
// Required method
fn diff(&self, old: &Self) -> Vec<String>;
// Provided method
fn fmt_value<T: Display>(&self, value: &T) -> String { ... }
}Expand description
Centralized cache invalidation logic with human readable differences
When a struct is used to represent values in a cache, this trait can be implemented to to determine whether or not that cache needs to be invalidated.
Required Methods§
Sourcefn diff(&self, old: &Self) -> Vec<String>
fn diff(&self, old: &Self) -> Vec<String>
Given another cache object, returns a list of differences between the two.
If no differences, return an empty list. An empty list should indicate that the cache should be retained (not invalidated). One or more items would indicate that the cached value should be invalidated.
Provided Methods§
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.