pub enum Error {
GuessingFormatFailed(String),
OpeningImageFailed(String),
}
Expand description
Enum representing all possible values the application can fail.
Variants§
GuessingFormatFailed(String)
Failed to guess the image format.
OpeningImageFailed(String)
Failed to open image file.
Implementations§
source§impl Error
impl Error
sourcepub fn print_error<W: Write>(&self, err_out: &mut W)
pub fn print_error<W: Write>(&self, err_out: &mut W)
Get the executable exit value from an Error
instance.
Examples
let mut out = Vec::new();
Error::GuessingFormatFailed("not_image.rs".to_string()).print_error(&mut out);
assert_eq!(String::from_iter(out.iter().map(|&i| i as char)),
"Failed to guess format of \"not_image.rs\".\n".to_string());
sourcepub fn exit_value(&self) -> i32
pub fn exit_value(&self) -> i32
Get the executable exit value from an Error
instance.
Examples
assert_eq!(Error::GuessingFormatFailed("".to_string()).exit_value(), 1);
assert_eq!(Error::OpeningImageFailed("".to_string()).exit_value(), 2);
Trait Implementations§
source§impl PartialEq<Error> for Error
impl PartialEq<Error> for Error
impl Eq for Error
impl StructuralEq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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
Mutably borrows from an owned value. Read more