file_storage/error/
reason.rs1use std::fmt::{Display, Formatter};
2
3#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
5pub enum Reason {
6 UnknownFileSystem,
8
9 UnsupportedOperation,
11
12 FileNotFound,
14
15 FileAlreadyExists,
17
18 Other,
20}
21
22impl Display for Reason {
23 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
24 let s: &str = match self {
25 Reason::UnknownFileSystem => "unknown file system",
26 Reason::UnsupportedOperation => "unsupported operation",
27 Reason::FileNotFound => "file not found",
28 Reason::FileAlreadyExists => "file already exists",
29 Reason::Other => "other",
30 };
31 write!(f, "{}", s)
32 }
33}