Skip to main content

WebpError

Enum WebpError 

Source
pub enum WebpError {
    InvalidData,
    Unsupported,
    Eof,
    NeedMore,
}
Expand description

The published-API error type for the flat decode_webp / extract_metadata decode paths.

This is intentionally coarse-grained — the stable shape downstream consumers match on. The internal Error enum (with its per-module variants) remains the richer surface for the low-level decode_webp_image / decode_lossless_image helpers; it maps into WebpError via the From<Error> impl.

Variants§

§

InvalidData

The input is not a well-formed WebP file (bad magic, malformed chunk structure, a sub-decoder rejected the bitstream, …).

§

Unsupported

The file is well-formed but carries an image kind this build does not decode yet — currently the §2.5 VP8 lossy bitstream and animation frame assembly.

§

Eof

The input ended before a complete image could be read.

§

NeedMore

More input is required to complete the decode (streaming callers).

Implementations§

Source§

impl WebpError

Source

pub fn invalid<S: Into<String>>(_msg: S) -> Self

Build an InvalidData variant from any string-like message.

The 0.1.2 published WebpError::InvalidData carried a String payload; the current rebuild collapses every malformed-bitstream failure to the unit variant so the historical constructor shape WebpError::invalid("message") keeps compiling. The message itself is discarded; callers that need the underlying diagnostic can match on the richer in-crate Error instead.

Source

pub fn unsupported<S: Into<String>>(_msg: S) -> Self

Build an Unsupported variant from any string-like message — the constructor counterpart of Self::invalid.

Trait Implementations§

Source§

impl Clone for WebpError

Source§

fn clone(&self) -> WebpError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WebpError

Source§

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

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

impl Display for WebpError

Source§

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

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

impl Eq for WebpError

Source§

impl Error for WebpError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DecodeError> for WebpError

Map an oxideav-vp8 decode failure onto the coarse published WebpError.

The oxideav-vp8 decoder refuses an inter-frame (oxideav_vp8::DecodeError::Unsupported), which collapses to WebpError::Unsupported. Every other decode failure — a malformed frame header, truncated partition, bad token stream — is a bitstream problem and maps to WebpError::InvalidData.

Note: the published surface specifies a From<oxideav_vp8::Vp8Error> adapter (the umbrella type), but Vp8Error is not yet published on crates.io (it landed on vp8 master after the v0.2.0 tag). This DecodeError adapter covers the live decode path against the published 0.2.0 API; the Vp8Error adapter is a follow-up once vp8 publishes it.

Source§

fn from(e: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for WebpError

Map the rich internal Error onto the coarse published WebpError.

Unsupported / NotImplemented collapse to WebpError::Unsupported; every other variant (a malformed container or a sub-decoder rejecting the bitstream) is WebpError::InvalidData.

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Vp8Error> for WebpError

Map the oxideav-vp8 umbrella oxideav_vp8::Vp8Error onto the coarse published WebpError.

The four variants share names with WebpError so the mapping is a straight 1-to-1 collapse — the String payloads on InvalidData / Unsupported are dropped (the unit-variant rebuild surfaces the variant only). Wired up against oxideav-vp8 0.2.1 (the release that first exports Vp8Error at the crate root).

The compile-time signature assertion lives in tests/api_compat_0_1_2.rs::crate_root_webp_error_from_vp8_error.

Source§

fn from(e: Vp8Error) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for WebpError

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for WebpError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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 = 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.