pub enum IoError {
InvalidFormat {
reason: &'static str,
},
UnsupportedFeature {
reason: &'static str,
},
DecodeFailed {
source: Box<dyn Error + Send + Sync>,
},
EncodeFailed {
source: Box<dyn Error + Send + Sync>,
},
Io(Error),
}Expand description
Crate-level I/O error.
Each variant classifies what went wrong. Variants that wrap a codec
error carry a type-erased source via Box<dyn Error + Send + Sync>,
keeping this type codec-agnostic (no feature-gated fields).
Match on the enum directly to branch on the error category.
§Examples
use fovea_io::IoError;
let err = IoError::InvalidFormat { reason: "not a PNG file" };
assert_eq!(err.to_string(), "invalid format: not a PNG file");
match err {
IoError::InvalidFormat { reason } => assert_eq!(reason, "not a PNG file"),
_ => unreachable!(),
}Variants§
InvalidFormat
The input bytes don’t match the expected format signature.
UnsupportedFeature
The file is structurally valid but contains data we can’t decode (e.g. unsupported bit depth, compression method, colour type).
DecodeFailed
The codec reported a corruption or constraint violation during decoding. The wrapped source carries the codec-specific detail.
EncodeFailed
An encoding operation failed. The wrapped source carries the codec-specific detail.
Io(Error)
A standard I/O error (read/write/seek failure).
Trait Implementations§
Source§impl Error for IoError
impl Error for IoError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for IoError
impl !UnwindSafe for IoError
impl Freeze for IoError
impl Send for IoError
impl Sync for IoError
impl Unpin for IoError
impl UnsafeUnpin for IoError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ConvertPixelExt for T
impl<T> ConvertPixelExt for T
Source§impl<T> FromLinear<T> for T
impl<T> FromLinear<T> for T
Source§fn from_linear(acc: T) -> T
fn from_linear(acc: T) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more