#[non_exhaustive]pub enum Error {
Backend(String),
QuotaExceeded {
needed: u64,
available: Option<u64>,
},
ValueTooLarge {
bytes: usize,
max_inline: usize,
},
LockerTooLarge {
bytes: u64,
budget: u64,
},
SchemaMismatch {
stored: String,
requested: String,
},
Corrupt(String),
UnsupportedVersion {
found: u8,
supported: u8,
},
Filter(String),
InvalidConfig(String),
Closed,
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Backend(String)
The underlying store failed for a reason we do not model specifically.
QuotaExceeded
The store is full. available is the backend’s own estimate and may be
absent on platforms that do not report one.
ValueTooLarge
A value was handed to an eager Locker that is too
large to hold resident.
Eager lockers answer get() synchronously and infallibly, so they can
never await a chunk fetch. Oversized values belong in a lazy locker.
LockerTooLarge
An eager locker’s contents exceed its resident budget, discovered while
opening it. Refusing here is the guardrail against typing locker()
where lazy_locker() was meant and quietly loading hundreds of
megabytes into memory.
SchemaMismatch
The stored data was written under a different type or filter chain than the one being opened.
postcard is not self-describing, so without this check opening
Locker<A> over data written as Locker<B> would decode garbage into a
perfectly valid-looking A.
Corrupt(String)
A stored value failed its checksum or could not be decoded.
UnsupportedVersion
The value’s envelope carries a format version this build cannot read.
Filter(String)
A user-supplied codec or cipher failed.
InvalidConfig(String)
A locker was opened with settings that contradict each other.
Closed
The Bank this handle belongs to has shut down.
Implementations§
Source§impl Error
impl Error
Sourcepub fn backend(msg: impl Display) -> Self
pub fn backend(msg: impl Display) -> Self
Convenience for backends reporting an opaque platform failure.
Sourcepub fn is_corruption(&self) -> bool
pub fn is_corruption(&self) -> bool
Whether this error says “the stored bytes are unreadable” rather than “the store failed” or “you asked for the wrong thing”.
This is the set crate::OnCorrupt::Skip acts on. A Backend or
Closed error is deliberately not in it: skipping a record because
the disk hiccuped would quietly drop data that is perfectly intact.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()