pub trait FnMemo<Arg, Output> {
// Required methods
fn call(&self, arg: Arg) -> Output;
fn clear_cache(&self);
}
Expand description
The memoized function.
Required Methods§
Sourcefn call(&self, arg: Arg) -> Output
fn call(&self, arg: Arg) -> Output
Calls the function. If the result of arg
is already cached,
it will return the cached result, otherwise, it calculates the result
and adds it to the cache.
Sourcefn clear_cache(&self)
fn clear_cache(&self)
Clears the cache.