pub enum CacheError {
CreateShard(PathBuf, Error),
Serialize(String, Error),
Write(PathBuf, Error),
Walk(Error),
Remove(PathBuf, Error),
}Expand description
What can go wrong at write time.
Reads are infallible by design: a corrupt or missing entry is a miss, not
an error, so get returns Option<Value>. The caller treats write
failures as non-fatal (log and continue); only the path to disk, the
serialisation, the directory creation, and eviction need error variants.
Variants§
CreateShard(PathBuf, Error)
The shard directory could not be created on put.
Serialize(String, Error)
Serialising the value to JSON failed. Should be unreachable for
values produced by serde_json itself, but the type permits any
Value, so the error path exists.
Write(PathBuf, Error)
Writing the JSON file failed (disk full, permissions, race with concurrent eviction).
Walk(Error)
Reading the cache directory during eviction failed.
Remove(PathBuf, Error)
Removing an entry during eviction failed.
Trait Implementations§
Source§impl Debug for CacheError
impl Debug for CacheError
Source§impl Display for CacheError
impl Display for CacheError
Source§impl Error for CacheError
impl Error for CacheError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for CacheError
impl !UnwindSafe for CacheError
impl Freeze for CacheError
impl Send for CacheError
impl Sync for CacheError
impl Unpin for CacheError
impl UnsafeUnpin for CacheError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more