Enum png::common::ParameterErrorKind

source ·
pub(crate) enum ParameterErrorKind {
    ImageBufferSize {
        expected: usize,
        actual: usize,
    },
    PolledAfterEndOfImage,
    PolledAfterFatalError,
}

Variants§

§

ImageBufferSize

A provided buffer must be have the exact size to hold the image data. Where the buffer can be allocated by the caller, they must ensure that it has a minimum size as hinted previously. Even though the size is calculated from image data, this does counts as a parameter error because they must react to a value produced by this library, which can have been subjected to limits.

Fields

§expected: usize
§actual: usize
§

PolledAfterEndOfImage

A bit like return None from an iterator. We use it to differentiate between failing to seek to the next image in a sequence and the absence of a next image. This is an error of the caller because they should have checked the number of images by inspecting the header data returned when opening the image. This library will perform the checks necessary to ensure that data was accurate or error with a format error otherwise.

§

PolledAfterFatalError

Attempt to continue decoding after a fatal, non-resumable error was reported (e.g. after [DecodingError::Format]). The only case when it is possible to resume after an error is an UnexpectedEof scenario - see [DecodingError::IoError].

Trait Implementations§

source§

impl Debug for ParameterErrorKind

source§

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

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

impl From<ParameterErrorKind> for ParameterError

source§

fn from(inner: ParameterErrorKind) -> 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.