use std::fmt::{Display, Formatter};
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
pub enum Reason {
UnknownFileSystem,
UnsupportedOperation,
FileNotFound,
FileAlreadyExists,
FileContentNotUTF8,
InvalidPath,
Other,
}
impl Display for Reason {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let s: &str = match self {
Reason::UnknownFileSystem => "unknown file system",
Reason::UnsupportedOperation => "unsupported operation",
Reason::FileNotFound => "file not found",
Reason::FileAlreadyExists => "file already exists",
Reason::FileContentNotUTF8 => "file content not utf-8",
Reason::InvalidPath => "invalid path",
Reason::Other => "other",
};
f.write_str(s)
}
}