#[non_exhaustive]pub enum Kind {
VersionMismatch,
MissingField,
TypeMismatch,
UnknownVersion,
UnknownVariant,
NumberOutOfRange,
MissingFile,
}Expand description
Well-known classes of load-side failure.
Used in two roles:
- As the source of an
ErrorviaFrom<Kind>(and the matchingFrom<Kind>forErrorwhich classifies recoverable / critical according toKind::is_recoverable). - As a probe value in error chains — high-level callers can introspect the kind to decide whether to try a fallback loader.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
VersionMismatch
The manifest’s $version does not match the loader’s expected
Load::VERSION.
MissingField
A required field is absent from the record.
TypeMismatch
The shape of the saved value does not match what the loader expected (e.g. found an array where an object was needed).
UnknownVersion
The manifest’s version is recognized as not matching the current schema, and the
type’s Load::load_legacy has no upgrade path
for it.
UnknownVariant
The variant tag read from the wire format does not match any known variant of the target enum.
NumberOutOfRange
A numeric value in the manifest does not fit in the requested Rust type (either out of range or would lose precision).
MissingFile
A $handle references a file name that is not registered in the
manifest’s files set.
Implementations§
Source§impl Kind
impl Kind
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Stable, human-readable description of this kind. Used as the default error
message when constructing an Error from a Kind.
Sourcepub const fn is_recoverable(self) -> bool
pub const fn is_recoverable(self) -> bool
Whether an error of this kind should be treated as recoverable by probing APIs (i.e., suitable for triggering a fallback to an alternative load strategy).
Recoverable kinds describe “the data did not match what this loader expected” (a different version or shape might still succeed). Critical kinds describe structural or integrity problems where retrying would be pointless or unsafe.
Trait Implementations§
impl Copy for Kind
Source§impl Error for Kind
impl Error for Kind
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()