#[non_exhaustive]pub enum SnapshotError {
HeaderTruncated {
expected: usize,
got: usize,
},
BadMagic {
got: [u8; 8],
},
UnsupportedFormat {
got: u16,
max: u16,
},
FormatTooOld {
got: u16,
min: u16,
},
SectionTruncated {
tag: String,
declared: usize,
got: usize,
},
VersionMismatch {
tag: String,
file_version: u8,
chip_supports: u8,
},
SectionInvalid {
tag: String,
reason: String,
},
MissingSection(String),
Eof(usize),
}Expand description
Errors produced by save-state encode / decode.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HeaderTruncated
The blob is shorter than the header.
BadMagic
The magic prefix is wrong.
UnsupportedFormat
The container format version is outside the range we understand.
FormatTooOld
The container is from an older release whose save states this build no longer reads (v2.9.8, ADR 0042: v2.9.7 and earlier).
SectionTruncated
A section body is shorter than its declared length.
Fields
VersionMismatch
A section had a version this build does not handle.
Every section reader accepts only its current layout (v2.9.8, ADR
0042), so this is what a state saved by another release of RustyNES
fails with, when its container format is still current: v2.9.8’s and
v2.9.9’s states, at v3.0.0. The message therefore says which way the
versions differ (v3.0.0; until then it gave only the two numbers, and
players read it as a damaged file).
Fields
SectionInvalid
A section’s body failed internal consistency checks.
MissingSection(String)
A required section was missing.
Eof(usize)
A section blob ran past EOF.
Implementations§
Source§impl SnapshotError
impl SnapshotError
Trait Implementations§
Source§impl Debug for SnapshotError
impl Debug for SnapshotError
Source§impl Display for SnapshotError
impl Display for SnapshotError
Source§impl Error for SnapshotError
impl Error for SnapshotError
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()