#[non_exhaustive]pub enum CacheError {
InvalidCapacity,
}Expand description
Errors produced by cache-mod.
The enum is #[non_exhaustive] — new variants may be added in minor
releases as additional cache types and eviction policies land.
§Example
use cache_mod::{CacheError, LruCache};
// Zero capacity is rejected up-front.
let result = LruCache::<u32, u32>::new(0);
assert_eq!(result.err(), Some(CacheError::InvalidCapacity));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InvalidCapacity
A cache constructor was called with a capacity of zero.
Every eviction policy in this crate requires at least one entry of
headroom, so capacity must be >= 1.
Trait Implementations§
Source§impl Clone for CacheError
impl Clone for CacheError
Source§fn clone(&self) -> CacheError
fn clone(&self) -> CacheError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheError
impl Debug for CacheError
Source§impl Display for CacheError
impl Display for CacheError
Source§impl Error for CacheError
Available on crate feature std only.
impl Error for CacheError
Available on crate feature
std only.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()
Source§impl Hash for CacheError
impl Hash for CacheError
Source§impl PartialEq for CacheError
impl PartialEq for CacheError
Source§fn eq(&self, other: &CacheError) -> bool
fn eq(&self, other: &CacheError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for CacheError
impl Eq for CacheError
impl StructuralPartialEq for CacheError
Auto Trait Implementations§
impl Freeze for CacheError
impl RefUnwindSafe for CacheError
impl Send for CacheError
impl Sync for CacheError
impl Unpin for CacheError
impl UnsafeUnpin for CacheError
impl UnwindSafe 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