[−][src]Trait fn_memo::unsync::Cache
The cache for single-thread memoization.
Associated Types
Loading content...Required methods
fn new() -> Self
Create an empty cache.
fn get(&self, arg: &Self::Arg) -> Option<&Self::Output>
Gets the cached result of arg
. If it is not cached,
returns None
.
fn cache(&mut self, arg: Self::Arg, result: Self::Output)
Caches the arg
with result
.
fn clear(&mut self)
Clears the cache.
Implementations on Foreign Types
impl<Arg: Clone + Eq + Hash, Output: Clone> Cache for HashMap<Arg, Output>
[src]
Use HashMap
as Cache
.
type Arg = Arg
type Output = Output
fn new() -> Self
[src]
fn get(&self, arg: &Arg) -> Option<&Output>
[src]
fn cache(&mut self, arg: Arg, result: Output)
[src]
fn clear(&mut self)
[src]
impl<Output: Clone> Cache for Vec<Option<Output>>
[src]
Use Vec
as Cache
for sequences.