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
impl WebpError
Sourcepub fn invalid<S: Into<String>>(_msg: S) -> Self
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.
Sourcepub fn unsupported<S: Into<String>>(_msg: S) -> Self
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§
impl Eq for WebpError
Source§impl Error for WebpError
impl Error for WebpError
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<DecodeError> for WebpError
Map an oxideav-vp8 decode failure onto the coarse published
WebpError.
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
fn from(e: DecodeError) -> Self
Source§impl From<Error> for WebpError
impl From<Error> for WebpError
Unsupported / NotImplemented collapse to WebpError::Unsupported;
every other variant (a malformed container or a sub-decoder rejecting
the bitstream) is WebpError::InvalidData.
Source§impl From<Vp8Error> for WebpError
Map the oxideav-vp8 umbrella oxideav_vp8::Vp8Error onto the
coarse published WebpError.
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.