proximipy/caching/
approximate_cache.rs

1use crate::numerics::comp::ApproxComparable;
2
3// size of caches in implementations where that should be known at comptime
4pub const COMPTIME_CACHE_SIZE: usize = 1024;
5
6pub trait ApproximateCache<K, V>
7where
8    K: ApproxComparable,
9    V: Clone,
10{
11    fn find(&mut self, key: &K) -> Option<V>;
12    fn insert(&mut self, key: K, value: V);
13    fn len(&self) -> usize;
14    fn is_empty(&self) -> bool {
15        self.len() == 0
16    }
17}