Skip to main content

ApuSnapshotError

Enum ApuSnapshotError 

Source
#[non_exhaustive]
pub enum ApuSnapshotError { Truncated(usize), TrailingBytes(usize), UnsupportedVersion(u8), InvalidRegion(u8), InvalidMode(u8), InvalidPresence(u8), FieldOutOfRange { field: &'static str, value: u8, max: u8, }, InvalidResampler(&'static str), }
Expand description

Errors returned by Apu::restore.

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

Truncated(usize)

Blob is shorter than the schema declares.

§

TrailingBytes(usize)

Blob is longer than the schema declares: this many bytes follow the last field (v2.9.8; until then reported as Self::Truncated).

§

UnsupportedVersion(u8)

The blob’s version byte is not understood by this build.

§

InvalidRegion(u8)

Region tag was not 0/1/2.

§

InvalidMode(u8)

Frame-counter mode tag was not 0/1.

§

InvalidPresence(u8)

Optional sample-buffer presence byte was not 0/1.

§

FieldOutOfRange

A register-width field held a value its hardware register cannot.

Several of these index fixed tables on the next tick (duty and step into the duty table, the triangle step into its 32-step sequence) or flow into one (decay, a constant-volume volume_or_period and the DMC dac sum into the mixer’s 31- and 203-entry lookup tables), so an unchecked value restores cleanly and then panics one CPU cycle later. The rest (sweep, DMC rate / bit count) cannot panic today but are bounded to the same register width so that no field of the restored state is one the emulator itself could never have written. Core audit IMP-02.

Fields

§field: &'static str

Which field, as channel.field.

§value: u8

The value found in the blob.

§max: u8

The largest value the hardware register can hold.

§

InvalidResampler(&'static str)

A floating-point resampler or filter field was not usable.

The band-limited resampler advances phase by sample_rate / cpu_rate per CPU cycle and emits one host sample per whole unit crossed, so a zero, negative, non-finite or merely huge ratio does not panic: it hangs the emulation thread in that loop, or fills the host audio with NaN. Core audit IMP-02.

Trait Implementations§

Source§

impl Debug for ApuSnapshotError

Source§

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

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

impl Display for ApuSnapshotError

Source§

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

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

impl Error for ApuSnapshotError

1.30.0 · 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

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