use crate::PutResult;
use core::borrow::Borrow;
use core::hash::Hash;
pub trait Cache<K: Hash + Eq, V> {
fn put(&mut self, k: K, v: V) -> PutResult<K, V>;
fn get<Q>(&mut self, k: &Q) -> Option<&V>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn peek<Q>(&self, k: &Q) -> Option<&V>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn peek_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn contains<Q>(&self, k: &Q) -> bool
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn remove<Q>(&mut self, k: &Q) -> Option<V>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn purge(&mut self);
fn len(&self) -> usize;
fn cap(&self) -> usize;
fn is_empty(&self) -> bool;
}
pub trait ResizableCache {
fn resize(&mut self, cap: usize) -> u64;
}