Skip to main content

MovieError

Enum MovieError 

Source
#[non_exhaustive]
pub enum MovieError {
Show 16 variants HeaderTruncated { expected: usize, got: usize, }, BadMagic { got: [u8; 8], }, UnsupportedFormat { got: u16, max: u16, }, FormatTooOld { got: u16, min: u16, }, UnknownFlags(u8), BadOptions(OptionsDecodeError), RegionMismatch { movie: Region, host: Region, }, BoardMismatch { field: &'static str, }, OptionNotApplicable(String), StartStateTooOld { got: u16, min: u16, }, UnsupportedFrameWidth { got: u8, max: u8, }, BadRegion(u8), Eof(usize), BadSaveState(SnapshotError), RomMismatch, EpochMismatch { movie: u32, core: u32, },
}
Expand description

Errors produced by movie encode / decode / playback.

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.
§

HeaderTruncated

The blob is shorter than the fixed header.

Fields

§expected: usize

Expected byte count.

§got: usize

Actual byte count.

§

BadMagic

The magic prefix is wrong.

Fields

§got: [u8; 8]

Bytes observed at the magic offset.

§

UnsupportedFormat

The container format version is outside the range we understand.

Fields

§got: u16

Version we read.

§max: u16

Highest version we accept.

§

FormatTooOld

v2.9.8 — the movie was written by an older release whose format does not record everything a faithful replay needs: before format 3 the emulation options, before 4 the full board, before 5 (v3.0.0) the emulation epoch. (Until v3.0.0 the message named only the options, which stopped being the whole story at format 4.)

Fields

§got: u16

Version we read.

§min: u16

Oldest version this build replays.

§

UnknownFlags(u8)

v2.9.8 — the header flags carry a bit this build does not know.

§

BadOptions(OptionsDecodeError)

v2.9.8 — the OPTIONS block is malformed (an unknown enum byte, a bad Game Genie code, a truncated field).

§

RegionMismatch

v2.9.8 — the movie was recorded on another region (from a header that said PAL, say, where this one says NTSC). A region is built into the machine at load, so it cannot be applied; the movie is refused.

Fields

§movie: Region

The movie’s region.

§host: Region

The running machine’s region.

§

BoardMismatch

v2.9.8 — same ROM, different header: the cartridge the movie ran on had another mapper, submapper, mirroring, RAM size, battery or trainer. Since v2.9.8 the ROM identity excludes the header, so this is what tells a re-headered dump (or a changed database correction) apart.

Fields

§field: &'static str

The first board field that differs.

§

OptionNotApplicable(String)

v2.9.8 — an option could not be applied to this machine (a Game Genie code that does not decode, in a hand-built movie).

§

StartStateTooOld

v2.9.8 — the movie’s embedded start-point save state predates the .rns container epoch 3 (ADR 0042), which v2.9.8 refuses. Kept apart from MovieError::BadSaveState so the message says what to do, in the same words as MovieError::FormatTooOld.

Fields

§got: u16

The embedded state’s container version.

§min: u16

Oldest container version this build reads.

§

UnsupportedFrameWidth

The header declared more bytes-per-frame than this build understands.

Fields

§got: u8

Declared width.

§max: u8

Width this build can parse.

§

BadRegion(u8)

The region byte is not a value this build understands.

§

Eof(usize)

The body (start point and/or input stream) ran past EOF.

§

BadSaveState(SnapshotError)

The embedded start-point save state failed to apply.

§

RomMismatch

The running ROM’s hash does not match the movie’s recorded hash.

§

EpochMismatch

v3.0.0 (ADR 0045) — the movie was recorded by a version of RustyNES that emulates differently: its EMULATION_EPOCH is not this build’s. Replaying it would run the recorded inputs on different timing, so it is refused rather than allowed to diverge.

Fields

§movie: u32

The epoch the movie records.

§core: u32

This build’s EMULATION_EPOCH.

Trait Implementations§

Source§

impl Debug for MovieError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for MovieError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for MovieError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<SnapshotError> for MovieError

Source§

fn from(source: SnapshotError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.