Skip to main content

MediaError

Enum MediaError 

Source
pub enum MediaError {
    UnsupportedFormat {
        format: StillFormat,
        op: FormatOp,
    },
    NotAStillImage,
    Decode {
        format: StillFormat,
        detail: String,
    },
    Encode {
        format: DerivativeFormat,
        detail: String,
    },
    ZeroDimension {
        width: u32,
        height: u32,
    },
    PixelBudgetExceeded {
        pixels: u64,
        limit: u64,
    },
    BufferLengthMismatch {
        format: StillFormat,
        width: u32,
        height: u32,
        expected: u128,
        actual: u128,
    },
    Sign {
        detail: String,
    },
    DecoderPanic,
}
Expand description

Why the still pipeline could not produce what was asked of it.

Variants§

§

UnsupportedFormat

The format was identified and this build links no codec for it in that direction — HEIC, AVIF and the RAW families for decode; everything but WebP for encode. The expected gap: the format table is honest about it and StillFormat::is_decodable is the same predicate the pipeline gates on, so this is reached only when a caller bypasses that gate.

Fields

§format: StillFormat

The format that was identified.

§op: FormatOp

Which half of the codec was missing.

§

NotAStillImage

The bytes are not any still image Capsule models — a video, an XMP sidecar, an SVG, or noise. Distinct from UnsupportedFormat: there is nothing to defer, because there is no still here to decode later either.

§

Decode

A format this build does decode did not decode these particular bytes — truncation, corruption, or a decoder bug. detail is the underlying decoder’s message, flattened to a String (rather than held as a #[source]) so this type stays Clone + PartialEq and so no pre-1.0 dependency type appears in Capsule’s public error shape.

Fields

§format: StillFormat

The format that was being decoded.

§detail: String

The decoder’s own message.

§

Encode

A derivative encode failed. Same shape and same reasoning as Decode.

Fields

§format: DerivativeFormat

The derivative format that was being written.

§detail: String

The encoder’s own message.

§

ZeroDimension

The decoded frame has a zero dimension. Guarded rather than trusted because crate::lqip::Lqip::encode and the downscale both need a non-empty frame, and a hand-crafted header can claim one.

Fields

§width: u32

The width the decoder reported.

§height: u32

The height the decoder reported.

§

PixelBudgetExceeded

The header claims more pixels than MAX_DECODE_PIXELS allows, and the decode was refused before allocating.

This is the decode-bomb guard, and it has to be a pre-decode check rather than a post-decode sanity assert: rawshift-image decodes to interleaved RGB u16, i.e. six bytes per pixel, so a 60000x60000 PNG asks for ~21 GB inside the decoder before Capsule ever sees a buffer.

Fields

§pixels: u64

The pixel count the header claims, or, for a frame refused after decode because its header understated it, the decoded frame’s.

§limit: u64

The budget in force.

§

BufferLengthMismatch

The decoder’s buffer length does not match the dimensions it reported. RgbImage validates this itself at the pinned revision; it is rechecked at the boundary rather than assumed across bumps of a pre-1.0 dependency.

Fields

§format: StillFormat

The format that was decoded.

§width: u32

The width the decoder reported.

§height: u32

The height the decoder reported.

§expected: u128

The sample count the dimensions imply.

§actual: u128

The sample count the decoder actually returned.

§

Sign

Signing or sealing a derivative manifest failed — a hardware device signer refused, or the album’s write-tier key for this epoch is missing.

The one derivative failure that is not about pixels, and the reason it has its own variant rather than being folded into Encode: every other error here says “this asset has no thumbnail”, which an import survives, while this one says the workspace cannot author a signed record — the same fault that would stop the asset’s own manifest. The import path propagates this and degrades on everything else, and it can only tell them apart if the type does.

Fields

§detail: String

The underlying crypto error’s message.

§

DecoderPanic

A third-party decoder panicked and the unwind was caught at the pipeline boundary.

A pre-1.0 decoder fed untrusted bytes is exactly the place a panic is plausible, and an import must never abort over a thumbnail. Reported as a decode failure rather than swallowed, because a panic is a defect worth seeing.

Trait Implementations§

Source§

impl Clone for MediaError

Source§

fn clone(&self) -> MediaError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaError

Source§

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

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

impl Display for MediaError

Source§

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

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

impl Eq for MediaError

Source§

impl Error for MediaError

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

impl PartialEq for MediaError

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MediaError

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more