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: StillFormatThe format that was identified.
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: StillFormatThe format that was being decoded.
Encode
A derivative encode failed. Same shape and same reasoning as
Decode.
Fields
format: DerivativeFormatThe derivative format that was being written.
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.
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
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: StillFormatThe format that was decoded.
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.
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
impl Clone for MediaError
Source§fn clone(&self) -> MediaError
fn clone(&self) -> MediaError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MediaError
impl Debug for MediaError
Source§impl Display for MediaError
impl Display for MediaError
impl Eq for MediaError
Source§impl Error for MediaError
impl Error for MediaError
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()
Source§impl PartialEq for MediaError
impl PartialEq for MediaError
Source§fn eq(&self, other: &MediaError) -> bool
fn eq(&self, other: &MediaError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MediaError
Auto Trait Implementations§
impl Freeze for MediaError
impl RefUnwindSafe for MediaError
impl Send for MediaError
impl Sync for MediaError
impl Unpin for MediaError
impl UnsafeUnpin for MediaError
impl UnwindSafe for MediaError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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