pub enum JpegCompressError {
NotEightBit,
UnsupportedArrayStructure,
UnknownColorMode(i32),
EncodeFailed,
}Expand description
Why compress_jpeg refused an array, carrying the exact errorMessage C
writes at that rejection point.
C’s compressJPEG sets a different string at each failure and the plugin
copies it verbatim into the CodecError PV, so the message is part of the
observable contract — which means the encoder, not its caller, has to name the
failure. A bare Option forced the caller to invent one generic text for all
of them.
Variants§
NotEightBit
C :135-143 — only NDInt8/NDUInt8 reach the encoder.
UnsupportedArrayStructure
C :165-169 — ndims is neither 2 nor 3.
UnknownColorMode(i32)
C :200-204 (and the identical guard inside the scanline loop, :228-232)
— the colorMode switch has no arm for this mode: Bayer and the YUVs.
EncodeFailed
C :234-238 — libjpeg would not take the data.
The port also lands here for the arrays C hands to libjpeg’s fatal error
handler: jpeg_std_error (:115) exits the process on error, so C has no
recovery path for dimensions past libjpeg’s limit, nor for the 3-D layouts
its else if chain (:155-164) leaves image_width/image_height unset
for — a 3-D array whose ColorMode is Mono, or whose colour axis is not 3.
The port reports the failure instead of aborting the IOC, under C’s own
text for “the encoder would not take this array”.
Implementations§
Trait Implementations§
Source§impl Clone for JpegCompressError
impl Clone for JpegCompressError
Source§fn clone(&self) -> JpegCompressError
fn clone(&self) -> JpegCompressError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for JpegCompressError
Source§impl Debug for JpegCompressError
impl Debug for JpegCompressError
impl Eq for JpegCompressError
Source§impl PartialEq for JpegCompressError
impl PartialEq for JpegCompressError
impl StructuralPartialEq for JpegCompressError
Auto Trait Implementations§
impl Freeze for JpegCompressError
impl RefUnwindSafe for JpegCompressError
impl Send for JpegCompressError
impl Sync for JpegCompressError
impl Unpin for JpegCompressError
impl UnsafeUnpin for JpegCompressError
impl UnwindSafe for JpegCompressError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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