Skip to main content

DecodeError

Enum DecodeError 

Source
#[non_exhaustive]
pub enum DecodeError {
Show 13 variants Hdr(HdrError), Platform(PlatformError), Unsupported { format: Format, width: i32, }, Crunch(CrunchError), NoImageData, NegativeSize { width: i32, height: i32, }, TooLarge { pixels: u64, max: u64, }, PillowMemoryError { width: u32, max: u32, }, NotEnoughData { needed: u64, got: u64, }, DecompressionBomb { pixels: u64, max: u64, }, PvrtcBlockCount, Charge(ChargeError), Panicked { payload: Payload, },
}
Expand description

Why a texture did not decode, in the order of the module docs’ checks. Every variant but Self::TooLarge, Self::Charge and Self::Panicked is a case where UnityPy 1.25.2 raises too, but for an ETC or EAC format with short data or a side padded below 0, where texture2ddecoder reads past the data (module docs, steps 3 and 6). plan() returns the checks’ variants only, never Charge or Panicked, which decode() alone gives, after a plan that passed.

Not Clone, by design, unlike the core’s errors: Panicked owns the panic’s payload, the box the unwinding carried (Payload), which cannot be cloned, and a copy of its text would allocate on the panic path.

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

Hdr(HdrError)

Reserved or illegal content in a specification-defined HDR block.

§

Platform(PlatformError)

An unsupported platform layout or a size that cannot be represented.

§

Unsupported

A Tier U layout: ARGBFloat, or YUY2 with an odd width.

Fields

§format: Format

The refused format.

§width: i32

The stored width.

§

Crunch(CrunchError)

A malformed legacy or Unity CRN stream or unsupported CRN feature.

§

NoImageData

The data is empty: UnityPy’s ValueError("Texture2D has no image data").

§

NegativeSize

A side is negative (and neither is 0): Pillow’s ValueError.

Fields

§width: i32

m_Width.

§height: i32

m_Height.

§

TooLarge

The texture passes MAX_PIXELS at its padded size, a bound UnityPy does not have.

Fields

§pixels: u64

Its pixels, padded to whole blocks.

§

PillowMemoryError

A raw texture’s row, or an ETC, EAC or ASTC texture’s padded row, wider than Pillow’s raw decoder takes: Pillow’s MemoryError (module docs, step 5).

Fields

§width: u32

The row’s width as Pillow’s raw decoder gets it: m_Width, padded to whole blocks for an ETC, EAC or ASTC format.

§max: u32

The widest row it takes: INT_MAX / bits - 7.

§

NotEnoughData

The data ends before mip 0 does: Pillow’s ValueError “not enough image data”, for an ASTC format UnityPy’s ValueError “Invalid ASTC data size”, or for an ETC or EAC format, where texture2ddecoder reads on past the data’s end, unityrs’s own refusal (module docs, step 6).

Fields

§needed: u64

What mip 0 holds, at its padded size.

§got: u64

The data’s length.

§

DecompressionBomb

UnityPy’s crop of a padded BCn image meets Pillow’s decompression-bomb check: its DecompressionBombError, whose message this one is (module docs, step 8).

Fields

§pixels: u64

m_Width x m_Height.

§

PvrtcBlockCount

texture2ddecoder refuses a PVRTC grid with non-power-of-two block counts.

§

Charge(ChargeError)

The meter or its budget refused the output buffer, or the allocator did; nothing was allocated.

§

Panicked

The decoder panicked (crate::contain()): its payload, kept whole.

Fields

§payload: Payload

The payload; Payload::message is the manifest’s detail.

Trait Implementations§

Source§

impl Debug for DecodeError

Source§

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

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

impl Display for DecodeError

Source§

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

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

impl Eq for DecodeError

Source§

impl Error for DecodeError

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

Replaced by Error::source.
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<ChargeError> for DecodeError

Source§

fn from(source: ChargeError) -> Self

Converts to this type from the input type.
Source§

impl From<CrunchError> for DecodeError

Source§

fn from(error: CrunchError) -> Self

Converts to this type from the input type.
Source§

impl From<DecodeError> for ArrayError

Source§

fn from(source: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl From<DecodeError> for SpriteError

Source§

fn from(e: DecodeError) -> Self

crate::contain()’s errors: a panic, or a charge.

Source§

impl From<DecodeError> for WriteError

Source§

fn from(source: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl From<HdrError> for DecodeError

Source§

fn from(source: HdrError) -> Self

Converts to this type from the input type.
Source§

impl From<PlatformError> for DecodeError

Source§

fn from(source: PlatformError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DecodeError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DecodeError

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.