1use core::fmt::{Display, Formatter};
2
3#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
5pub enum CacheError {
6 InvalidSize(usize),
8 InvalidRecentRatio(f64),
12 InvalidGhostRatio(f64),
16}
17
18impl Display for CacheError {
19 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
20 match self {
21 CacheError::InvalidSize(size) => write!(f, "invalid cache size {}", *size),
22 CacheError::InvalidRecentRatio(r) => write!(f, "invalid recent ratio {}", *r),
23 CacheError::InvalidGhostRatio(r) => write!(f, "invalid ghost ratio {}", *r),
24 }
25 }
26}