Skip to main content

MalformedError

Enum MalformedError 

Source
#[non_exhaustive]
pub enum MalformedError {
Show 45 variants UnexpectedEof { offset: u64, needed: u64, remaining: u64, }, InvalidFileSignature, ReservedFileHeaderFlags(u8), InvalidBitCount(u8), ReservedSegmentType(u8), InvalidReferredToCountCode(u8), NonCanonicalReferredToCount(u32), NonZeroUnusedRetentionFlags, InvalidReferredSegmentNumber { segment: u32, referred: u32, }, InvalidExtensionType(u32), InvalidCommentExtension, InvalidProfilesSegment(u32), InvalidHuffman(HuffmanErrorKind), InvalidArithmeticContextState { state_index: u8, mps: u8, }, InsufficientArithmeticContexts { required: usize, actual: usize, }, InvalidIaidCodeLength(u8), InvalidMmr(MmrErrorKind), InvalidSymbolText(&'static str), SymbolIdOutOfRange { id: u32, available: u32, }, InvalidSymbolDimensions, InvalidHalftone(HalftoneErrorKind), InvalidGenericRegion(GenericRegionErrorKind), InvalidPageState(&'static str), InvalidUnknownSegmentLength(u8), InvalidSegmentDataLength { segment_type: u8, expected: u64, actual: u64, }, ReservedRegionFlags(u8), InvalidCombinationOperator(u8), UnknownHeightWithoutStriping, InvalidStripeEndRow(u32), DuplicateSegmentNumber(u32), NonIncreasingSegmentNumber { previous: u32, current: u32, }, MissingReferredSegment { segment: u32, referred: u32, }, InvalidPageAssociation { segment: u32, page: u32, }, MissingPageInformation(u32), DuplicatePageBoundary { page: u32, segment_type: u8, }, SegmentAfterEndOfPage { segment: u32, page: u32, }, MissingEndOfPage(u32), MissingEndOfFile, TrailingData(u64), PageCountMismatch { declared: u32, actual: u32, }, InvalidSegmentReferences(u32), MissingGenericRegionTerminator, GenericRegionRowCount { declared: u32, actual: u32, }, InvalidRetentionFlags { segment: u32, referred: u32, }, IntegerOverflow,
}
Expand description

A deterministic classification of malformed input.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

UnexpectedEof

The input ended before a complete value was available.

Fields

§offset: u64

Byte or bit offset at which the read started.

§needed: u64

Number of bytes or bits requested.

§remaining: u64

Number of bytes or bits that remained.

§

InvalidFileSignature

A standalone file did not start with the JBIG2 identifier.

§

ReservedFileHeaderFlags(u8)

Reserved file-header flag bits were non-zero.

§

InvalidBitCount(u8)

A bit read requested more than the supported 32 bits.

§

ReservedSegmentType(u8)

A reserved segment type appeared in a segment header.

§

InvalidReferredToCountCode(u8)

The three-bit referred-to count discriminator was reserved.

§

NonCanonicalReferredToCount(u32)

Long-form referred-to counts were used for four or fewer references.

§

NonZeroUnusedRetentionFlags

Unused retention bits were non-zero.

§

InvalidReferredSegmentNumber

A segment referred to itself or a later-numbered segment.

Fields

§segment: u32

Number of the segment containing the reference.

§referred: u32

Invalid referred-to segment number.

§

InvalidExtensionType(u32)

An extension header violates reserved/necessary flag rules.

§

InvalidCommentExtension

A defined comment extension is not correctly terminated.

§

InvalidProfilesSegment(u32)

Profiles metadata is misplaced, duplicated, or not restrictive enough.

§

InvalidHuffman(HuffmanErrorKind)

A Huffman table or coded prefix is malformed.

§

InvalidArithmeticContextState

A restored arithmetic probability context is invalid.

Fields

§state_index: u8

Table E.1 state index.

§mps: u8

More-probable symbol value.

§

InsufficientArithmeticContexts

An arithmetic procedure was given too few probability contexts.

Fields

§required: usize

Required number of contexts.

§actual: usize

Supplied number of contexts.

§

InvalidIaidCodeLength(u8)

IAID code length cannot be represented safely.

§

InvalidMmr(MmrErrorKind)

An MMR mode, run, transition, marker, or padding rule is invalid.

§

InvalidSymbolText(&'static str)

A symbol dictionary or text-region state-machine rule is invalid.

§

SymbolIdOutOfRange

A decoded symbol ID does not name an available symbol.

Fields

§id: u32

Decoded symbol ID.

§available: u32

Number of available symbols.

§

InvalidSymbolDimensions

Refined or collective symbol dimensions are invalid.

§

InvalidHalftone(HalftoneErrorKind)

A pattern dictionary or halftone rule is invalid.

§

InvalidGenericRegion(GenericRegionErrorKind)

A generic or refinement region rule is invalid.

§

InvalidPageState(&'static str)

Decoded segment order or page policy is inconsistent.

§

InvalidUnknownSegmentLength(u8)

An unknown segment length appeared on a segment type that forbids it.

§

InvalidSegmentDataLength

A segment payload length did not match its fixed syntax.

Fields

§segment_type: u8

Numeric segment type.

§expected: u64

Required number of bytes.

§actual: u64

Actual number of bytes.

§

ReservedRegionFlags(u8)

A reserved region information flag was set.

§

InvalidCombinationOperator(u8)

A region selected an undefined external combination operator.

§

UnknownHeightWithoutStriping

An unknown-height page was not marked as striped.

§

InvalidStripeEndRow(u32)

An end-of-stripe row exceeds its page or is not increasing.

§

DuplicateSegmentNumber(u32)

Segment numbers are duplicated.

§

NonIncreasingSegmentNumber

Standalone segment headers are not in increasing number order.

Fields

§previous: u32

Previous segment number.

§current: u32

Current segment number.

§

MissingReferredSegment

A referred-to segment is absent from the available document state.

Fields

§segment: u32

Referring segment number.

§referred: u32

Missing segment number.

§

InvalidPageAssociation

A segment has an invalid global or page association.

Fields

§segment: u32

Segment number.

§page: u32

Page association.

§

MissingPageInformation(u32)

A page’s first associated segment was not page information.

§

DuplicatePageBoundary

A page has duplicate page-information or end-of-page segments.

Fields

§page: u32

Page number.

§segment_type: u8

Boundary segment type.

§

SegmentAfterEndOfPage

A segment associated with a page appeared after its end-of-page segment.

Fields

§segment: u32

Segment number.

§page: u32

Page number.

§

MissingEndOfPage(u32)

A page did not end with an end-of-page segment.

§

MissingEndOfFile

A random-access file did not contain a final end-of-file header.

§

TrailingData(u64)

Bytes occurred after a terminal end-of-file segment.

§

PageCountMismatch

The declared page count differs from parsed pages.

Fields

§declared: u32

Declared page count.

§actual: u32

Parsed page count.

§

InvalidSegmentReferences(u32)

A fixed-length segment contains semantically invalid reference types.

§

MissingGenericRegionTerminator

An unknown-length generic region terminator was not found.

§

GenericRegionRowCount

An unknown-length generic region row count exceeds its declared height.

Fields

§declared: u32

Declared region height.

§actual: u32

Encoded terminal row count.

§

InvalidRetentionFlags

Retention flags permit discarding a segment before its final use.

Fields

§segment: u32

Segment carrying the invalid retention decision.

§referred: u32

Segment whose state would be discarded incorrectly.

§

IntegerOverflow

An input-derived arithmetic operation overflowed.

Trait Implementations§

Source§

impl Debug for MalformedError

Source§

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

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

impl Display for MalformedError

Source§

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

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

impl Eq for MalformedError

Source§

impl From<MalformedError> for DecodeError

Source§

fn from(error: MalformedError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for MalformedError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MalformedError

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.