2021-02-14 17:12:27 +00:00
|
|
|
use std::fmt::{Display, Formatter, Result};
|
|
|
|
|
2021-02-21 14:07:50 +00:00
|
|
|
#[derive(Debug)]
|
2021-02-10 09:20:22 +00:00
|
|
|
pub enum ScanError {
|
2021-02-28 14:06:05 +00:00
|
|
|
/// Something went wrong while trying to read the given file.
|
2021-02-10 09:20:22 +00:00
|
|
|
File,
|
2021-02-28 14:06:05 +00:00
|
|
|
/// Failed to determine the mimetype of the given file.
|
2021-02-18 09:48:38 +00:00
|
|
|
Mime,
|
2021-02-14 17:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Display for ScanError {
|
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
2021-02-18 09:48:38 +00:00
|
|
|
write!(
|
|
|
|
f,
|
|
|
|
"{}",
|
|
|
|
match self {
|
|
|
|
Self::File => "Couldn't read file",
|
|
|
|
Self::Mime => "Couldn't determine mime type",
|
|
|
|
}
|
2021-02-14 17:12:27 +00:00
|
|
|
)
|
|
|
|
}
|
2021-02-18 09:48:38 +00:00
|
|
|
}
|