pub enum StateError {
KeyNotFound {
namespace: String,
key: String,
},
UnsafeSegment {
which: &'static str,
value: String,
},
IoBackup(Error),
IoRead(Error),
IoWrite(Error),
Serde(Error),
ShapeInvalid {
reason: String,
},
}Expand description
Errors returned by the dispatched-layout helpers
(list_dispatched, show_dispatched, reset_dispatched_with_backup).
Unlike the legacy StateStore trait methods (which return String
errors), these helpers use a typed enum so callers can distinguish
missing-key from I/O failure at the type level without pattern-matching
on OS error codes.
Variants§
KeyNotFound
The requested key does not exist in the given namespace.
§Arguments
namespace— the namespace that was searchedkey— the key that was not found
UnsafeSegment
A namespace or key segment failed the path-safety check.
§Arguments
which— either"namespace"or"key"value— the offending segment value
IoBackup(Error)
A backup I/O operation (fs::copy to .bak) failed.
Wraps the underlying std::io::Error. Kept separate from
StateError::IoWrite so callers know that the live file was
not yet touched when this error occurs.
IoRead(Error)
A read or directory-scan operation failed.
Wraps the underlying std::io::Error. Covers fs::read_to_string,
fs::read_dir, and DirEntry iteration.
IoWrite(Error)
A write or rename operation on the live file or its .tmp
staging copy failed.
Wraps the underlying std::io::Error. Covers fs::write and
fs::rename.
Serde(Error)
JSON serialization or deserialization failed.
Uses #[from] so ? auto-converts serde_json::Error.
ShapeInvalid
The stored JSON does not have the expected shape.
§Arguments
reason— human-readable description of the shape violation (e.g."missing 'data' top-level field"or"data.completed_steps must be an array")
Trait Implementations§
Source§impl Debug for StateError
impl Debug for StateError
Source§impl Display for StateError
impl Display for StateError
Source§impl Error for StateError
impl Error for StateError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for StateError
impl !UnwindSafe for StateError
impl Freeze for StateError
impl Send for StateError
impl Sync for StateError
impl Unpin for StateError
impl UnsafeUnpin for StateError
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
Source§impl<E> ExternalError for E
impl<E> ExternalError for E
fn into_lua_err(self) -> Error
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.