[−][src]Trait fn_cache::FnCache
The generic trait for all caches.
This trait is implemented on all caches. This allows
someone to write a function like
fn f(cache: &mut impl FnCache<u32,u32>, x: &u32) -> u32
and have it work for all the caches written in this crate.
Required methods
fn get(&mut self, input: I) -> &O
Retrieve a value stored in the cache. If the value does not yet exist in the cache, the function is called, and the result is added to the cache before returning it.
Implementors
impl<'a, I, O, S> FnCache<I, O> for HashCache<'a, I, O, S> where
I: Eq + Hash,
S: BuildHasher,
[src]
I: Eq + Hash,
S: BuildHasher,
impl<'a, I, O, V> FnCache<I, V> for BTreeCache<'a, I, O, V> where
I: Ord,
O: Into<V>,
[src]
I: Ord,
O: Into<V>,