#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
#![deny(elided_lifetimes_in_paths)]
mod error;
pub mod replacer;
use std::{error::Error, fmt, hash::Hash};
pub use {
error::{EvictError, EvictResult},
replacer::{LruKConfig, LruKReplacer, LruReplacer},
};
pub trait FrameId: Clone + Hash + Eq + fmt::Display + fmt::Debug {}
impl<T> FrameId for T where T: Copy + Hash + Eq + fmt::Display + fmt::Debug {}
pub trait AccessType {}
pub trait EvictionPolicy<F: FrameId> {
type Error: Error;
fn evict(&self) -> Option<F>;
fn peek(&self) -> Option<F>;
fn touch(&self, id: F) -> Result<(), Self::Error>;
fn touch_with<T: AccessType>(&self, id: F, access_type: T) -> Result<(), Self::Error>;
fn pin(&self, id: F) -> Result<(), Self::Error>;
fn unpin(&self, id: F) -> Result<(), Self::Error>;
fn remove(&self, id: F) -> Result<(), Self::Error>;
fn capacity(&self) -> usize;
fn size(&self) -> usize;
}