Enum png::decoder::stream::FormatErrorInner

source ·
pub(crate) enum FormatErrorInner {
Show 34 variants CrcMismatch { crc_val: u32, crc_sum: u32, chunk: ChunkType, }, InvalidSignature, MissingFctl, MissingImageData, ChunkBeforeIhdr { kind: ChunkType, }, AfterIdat { kind: ChunkType, }, BeforePlte { kind: ChunkType, }, AfterPlte { kind: ChunkType, }, OutsidePlteIdat { kind: ChunkType, }, DuplicateChunk { kind: ChunkType, }, ApngOrder { present: u32, expected: u32, }, ShortPalette { expected: usize, len: usize, }, InvalidSbitChunkSize { color_type: ColorType, expected: usize, len: usize, }, InvalidSbit { sample_depth: BitDepth, sbit: u8, }, PaletteRequired, InvalidColorBitDepth { color_type: ColorType, bit_depth: BitDepth, }, ColorWithBadTrns(ColorType), InvalidDimensions, InvalidBitDepth(u8), InvalidColorType(u8), InvalidDisposeOp(u8), InvalidBlendOp(u8), InvalidUnit(u8), InvalidSrgbRenderingIntent(u8), UnknownCompressionMethod(u8), UnknownFilterMethod(u8), UnknownInterlaceMethod(u8), BadSubFrameBounds {}, CorruptFlateStream { err: DecompressionError, }, NoMoreImageData, BadTextEncoding(TextDecodingError), FdatShorterThanFourBytes, UnexpectedRestartOfDataChunkSequence { kind: ChunkType, }, ChunkTooShort { kind: ChunkType, },
}

Variants§

§

CrcMismatch

Bad framing.

Fields

§crc_val: u32

Stored CRC32 value

§crc_sum: u32

Calculated CRC32 sum

§chunk: ChunkType

The chunk type that has the CRC mismatch.

§

InvalidSignature

Not a PNG, the magic signature is missing.

§

MissingFctl

Fctl must occur if an animated chunk occurs.

§

MissingImageData

Image data that was indicated in IHDR or acTL is missing.

§

ChunkBeforeIhdr

4.3., Must be first.

Fields

§

AfterIdat

4.3., some chunks must be before IDAT.

Fields

§

BeforePlte

Fields

§

AfterPlte

4.3., some chunks must be before PLTE.

Fields

§

OutsidePlteIdat

4.3., some chunks must be between PLTE and IDAT.

Fields

§

DuplicateChunk

4.3., some chunks must be unique.

Fields

§

ApngOrder

Specifically for fdat there is an embedded sequence number for chunks.

Fields

§present: u32

The sequence number in the chunk.

§expected: u32

The one that should have been present.

§

ShortPalette

The palette did not even contain a single pixel data.

Fields

§expected: usize
§len: usize
§

InvalidSbitChunkSize

sBIT chunk size based on color type.

Fields

§color_type: ColorType
§expected: usize
§len: usize
§

InvalidSbit

Fields

§sample_depth: BitDepth
§sbit: u8
§

PaletteRequired

A palletized image did not have a palette.

§

InvalidColorBitDepth

The color-depth combination is not valid according to Table 11.1.

Fields

§color_type: ColorType
§bit_depth: BitDepth
§

ColorWithBadTrns(ColorType)

§

InvalidDimensions

The image width or height is zero.

§

InvalidBitDepth(u8)

§

InvalidColorType(u8)

§

InvalidDisposeOp(u8)

§

InvalidBlendOp(u8)

§

InvalidUnit(u8)

§

InvalidSrgbRenderingIntent(u8)

The rendering intent of the sRGB chunk is invalid.

§

UnknownCompressionMethod(u8)

§

UnknownFilterMethod(u8)

§

UnknownInterlaceMethod(u8)

§

BadSubFrameBounds

The subframe is not in bounds of the image. TODO: fields with relevant data.

§

CorruptFlateStream

The compression of the data stream was faulty.

§

NoMoreImageData

The image data chunk was too short for the expected pixel count.

§

BadTextEncoding(TextDecodingError)

Bad text encoding

§

FdatShorterThanFourBytes

fdAT shorter than 4 bytes

§

UnexpectedRestartOfDataChunkSequence

“11.2.4 IDAT Image data” section of the PNG spec says: There may be multiple IDAT chunks; if so, they shall appear consecutively with no other intervening chunks. UnexpectedRestartOfDataChunkSequence{kind: IDAT} indicates that there were “intervening chunks”.

The APNG spec doesn’t directly describe an error similar to CantInterleaveIdatChunks, but we require that a new sequence of consecutive fdAT chunks cannot appear unless we’ve seen an fcTL chunk.

Fields

§

ChunkTooShort

Failure to parse a chunk, because the chunk didn’t contain enough bytes.

Fields

Trait Implementations§

source§

impl Debug for FormatErrorInner

source§

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

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

impl From<FormatErrorInner> for FormatError

source§

fn from(inner: FormatErrorInner) -> Self

Converts to this type from the input type.

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