use core::hash::Hash;
pub trait Cache<K, V>
where
K: Eq + Hash,
V: Clone,
{
#[must_use = "the value lookup is the whole reason to call `get`; dropping it is almost certainly a bug"]
fn get(&self, key: &K) -> Option<V>;
fn insert(&self, key: K, value: V) -> Option<V>;
fn remove(&self, key: &K) -> Option<V>;
#[must_use = "ignoring `contains_key` defeats its purpose; use `_` to drop it explicitly"]
fn contains_key(&self, key: &K) -> bool;
#[must_use = "ignoring `len` defeats its purpose; use `_` to drop it explicitly"]
fn len(&self) -> usize;
#[must_use = "ignoring `is_empty` defeats its purpose; use `_` to drop it explicitly"]
fn is_empty(&self) -> bool {
self.len() == 0
}
fn clear(&self);
#[must_use = "ignoring `capacity` defeats its purpose; use `_` to drop it explicitly"]
fn capacity(&self) -> usize;
}