Skip to main content

mirui/cache/
error.rs

1#[derive(Debug)]
2pub enum CacheError<E = core::convert::Infallible> {
3    Disabled,
4    TooLarge,
5    Factory(E),
6}
7
8impl<E: core::fmt::Display> core::fmt::Display for CacheError<E> {
9    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
10        match self {
11            CacheError::Disabled => f.write_str("cache disabled (max_size = 0)"),
12            CacheError::TooLarge => f.write_str("entry exceeds cache max_size"),
13            CacheError::Factory(e) => write!(f, "factory error: {e}"),
14        }
15    }
16}