0
I've came up with the following implementation of a very simple cache:
use std::cmp::Eq;
use std::collections::HashMap;
use std::hash::Hash;
pub struct Cache<I, R, F>
where I: Copy + Eq + Hash, F: Fn(I) -> R
{
calculation: F,
values: HashMap<I, R>,
}
impl<I, R, F> Cache<I, R, F> wh...