pub enum ImageError {
Unreadable {
path: PathBuf,
source: Error,
},
Undecodable {
path: PathBuf,
source: ImageError,
},
TooLarge {
path: PathBuf,
width: u32,
height: u32,
},
}Expand description
Why a picture could not be shown.
Variants§
Unreadable
The file could not be read at all: gone, or not permitted.
Undecodable
The file is there and readable, and is not a picture this build can decode — a format nobody enabled, or bytes that are not an image at all.
Distinct from ImageError::Unreadable because the two need
different sentences: one is “this file is missing”, the other is
“this file is not something I can open”, and a viewer that says
the first about the second sends the user looking for a problem
with their disk.
TooLarge
The header parsed and claims dimensions past what may be decoded
at all — see crate::budget.
Its own case rather than an Undecodable, because nothing is
wrong with the file: this is a refusal, and it is the one failure
here that a bigger machine would not have.
Implementations§
Trait Implementations§
Source§impl Debug for ImageError
impl Debug for ImageError
Source§impl Display for ImageError
impl Display for ImageError
Source§impl Error for ImageError
impl Error for ImageError
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()