#[non_exhaustive]pub enum JpegError {
Show 39 variants
Truncated {
offset: usize,
expected: usize,
},
InvalidMarker {
offset: usize,
marker: u8,
},
UnexpectedMarker {
offset: usize,
expected: MarkerKind,
found: u8,
},
MissingMarker {
marker: MarkerKind,
},
DuplicateMarker {
offset: usize,
marker: MarkerKind,
},
InvalidSegmentLength {
offset: usize,
marker: u8,
length: u16,
},
ConflictingDuplicateTable {
offset: usize,
table: TableKind,
id: u8,
},
ExpectedDimensionsRequired {
offset: usize,
},
ConflictingExpectedDimensions {
offset: usize,
expected: (u16, u16),
actual: (u16, u16),
},
InvalidJpegAssembly {
offset: usize,
reason: &'static str,
},
ConflictingDri {
offset: usize,
existing: u16,
new: u16,
},
UnsupportedSof {
marker: u8,
reason: UnsupportedReason,
},
UnsupportedComponentCount {
count: u8,
},
UnsupportedColorSpace {
color_space: ColorSpace,
},
UnsupportedBitDepth {
depth: u8,
},
UnsupportedPredictor {
predictor: u8,
},
ZeroDimension {
width: u16,
height: u16,
},
DimensionOverflow {
width: u32,
height: u32,
},
InvalidSampling {
component: u8,
h: u8,
v: u8,
},
MissingQuantTable {
component: u8,
table_id: u8,
},
MissingHuffmanTable {
component: u8,
class: u8,
id: u8,
},
InvalidScanParameters {
offset: usize,
ss: u8,
se: u8,
ah: u8,
al: u8,
},
UnknownScanComponent {
offset: usize,
component: u8,
},
DuplicateScanComponent {
offset: usize,
component: u8,
},
InvalidSequentialComponentSet {
offset: usize,
expected: u8,
found: u8,
},
InvalidSequentialScanCount {
sof: SofKind,
count: u16,
},
HuffmanDecode {
mcu: u32,
reason: HuffmanFailure,
},
RestartMismatch {
offset: usize,
expected: u8,
found: u8,
},
UnexpectedEoi {
mcu_at: u32,
mcu_total: u32,
},
CoefficientOverflow {
mcu: u32,
component: u8,
},
MemoryCapExceeded {
requested: usize,
cap: usize,
},
OutputBufferTooSmall {
required: usize,
provided: usize,
},
InvalidStride {
stride: usize,
row: usize,
},
RectOutOfBounds {
rect: Rect,
width: u32,
height: u32,
},
DownscaleUnsupported {
sof: SofKind,
},
ScanFragmentsOverlap {
mcu: u32,
},
BuilderConflict {
reason: BuilderConflictReason,
},
NotImplemented {
sof: SofKind,
},
RowSinkAborted,
}Expand description
Fatal JPEG decode or API error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated
Input ended before the requested bytes could be read.
Fields
InvalidMarker
Marker byte is not legal in the current JPEG position.
UnexpectedMarker
A different marker kind was required at this position.
Fields
expected: MarkerKindMarker kind expected by the parser.
MissingMarker
Required marker was absent from the stream.
Fields
marker: MarkerKindMissing marker kind.
DuplicateMarker
A marker appeared more than once where only one is legal.
InvalidSegmentLength
Marker segment length is invalid for the marker kind.
Fields
ConflictingDuplicateTable
Duplicate DQT/DHT table has different bytes from an earlier definition.
Fields
ExpectedDimensionsRequired
TIFF/NDPI metadata did not provide dimensions needed to repair a zero SOF.
ConflictingExpectedDimensions
Container-provided dimensions conflict with non-zero SOF dimensions.
Fields
InvalidJpegAssembly
TIFF/JPEGTables assembly cannot produce a valid JPEG interchange stream.
Fields
ConflictingDri
Duplicate DRI marker conflicts with an earlier DRI value.
Fields
UnsupportedSof
Unsupported SOF variant. Carries the raw marker byte (e.g. 0xC9 for
arithmetic extended-sequential) so callers routing to a fallback
decoder can distinguish FFC5 from FFC9 without relying on reason.
SOF marker class is outside the decoder’s supported JPEG subset.
UnsupportedComponentCount
Component count is outside the supported range.
UnsupportedColorSpace
Color space cannot be produced by the requested decode path.
Fields
color_space: ColorSpaceHeader-derived color space.
UnsupportedBitDepth
Sample precision is not supported by this decoder path.
UnsupportedPredictor
Lossless predictor selection is unsupported.
ZeroDimension
SOF declares a zero width or height.
DimensionOverflow
Dimensions exceed this crate’s safe decode bounds.
InvalidSampling
Component sampling factors are outside the JPEG legal range.
MissingQuantTable
Component references a quantization table that was not defined.
MissingHuffmanTable
Scan references a Huffman table that was not defined.
InvalidScanParameters
Scan spectral selection or approximation parameters are invalid.
Fields
UnknownScanComponent
Scan references a component id not declared in the SOF.
DuplicateScanComponent
Scan lists the same component more than once.
InvalidSequentialComponentSet
Sequential scan does not contain the expected component set.
Fields
InvalidSequentialScanCount
Sequential SOF contained an invalid number of scans.
HuffmanDecode
Huffman entropy decoding failed. mcu is the current MCU when the
caller has MCU progress, or 0 for table/bitstream contexts that do
not track image position.
Fields
reason: HuffmanFailureFailure category.
RestartMismatch
Restart marker sequence did not match the expected RST index.
Fields
UnexpectedEoi
EOI was reached before all MCUs were decoded.
Fields
CoefficientOverflow
Decoded coefficient exceeded the representable range.
MemoryCapExceeded
Requested decode allocation exceeds the configured memory cap.
OutputBufferTooSmall
Caller-provided output buffer is too small.
InvalidStride
Output stride is smaller than the decoded row size.
RectOutOfBounds
Requested decode rectangle is outside image bounds.
Fields
DownscaleUnsupported
Requested downscale is not supported for the SOF kind.
ScanFragmentsOverlap
Builder-provided scan fragments overlap in MCU space.
BuilderConflict
Decoder builder inputs conflict.
Fields
reason: BuilderConflictReasonConflict category.
NotImplemented
Transient pre-1.0 gap: the SOF is parseable and may eventually be
supported by the decoder, but the current release does not implement
the requested shape yet. Distinct from UnsupportedSof because callers
routing to a fallback decoder on is_unsupported() should NOT reroute
streams that a newer version of j2k will decode natively.
RowSinkAborted
Row sink returned an error and aborted row-based decoding.
Implementations§
Source§impl JpegError
impl JpegError
Sourcepub fn is_unsupported(&self) -> bool
pub fn is_unsupported(&self) -> bool
True if the error is recoverable by routing to a different decoder —
any Unsupported* variant.
Sourcepub fn is_truncated(&self) -> bool
pub fn is_truncated(&self) -> bool
True if the input was truncated — caller may retry with more bytes.
Sourcepub fn is_api_misuse(&self) -> bool
pub fn is_api_misuse(&self) -> bool
True if the error indicates caller misuse, not a decode failure.
Sourcepub fn is_not_implemented(&self) -> bool
pub fn is_not_implemented(&self) -> bool
True if the error is a transient “not yet implemented” gap — the stream
is valid and will decode on a future j2k release, so callers
should not reroute to a different decoder permanently. See
Self::is_unsupported for errors that are permanent routing decisions.
Trait Implementations§
Source§impl CodecError for JpegError
impl CodecError for JpegError
Source§fn is_truncated(&self) -> bool
fn is_truncated(&self) -> bool
Source§fn is_not_implemented(&self) -> bool
fn is_not_implemented(&self) -> bool
Source§fn is_unsupported(&self) -> bool
fn is_unsupported(&self) -> bool
Source§fn is_buffer_error(&self) -> bool
fn is_buffer_error(&self) -> bool
impl Eq for JpegError
Source§impl Error for JpegError
impl Error for JpegError
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 From<JpegError> for FastPacketError
impl From<JpegError> for FastPacketError
impl StructuralPartialEq for JpegError
Auto Trait Implementations§
impl Freeze for JpegError
impl RefUnwindSafe for JpegError
impl Send for JpegError
impl Sync for JpegError
impl Unpin for JpegError
impl UnsafeUnpin for JpegError
impl UnwindSafe for JpegError
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<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