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 FileContentNotUTF8,
20
21 Other,
24}
25
26impl Display for Reason {
27 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
28 let s: &str = match self {
29 Reason::UnknownFileSystem => "unknown file system",
30 Reason::UnsupportedOperation => "unsupported operation",
31 Reason::FileNotFound => "file not found",
32 Reason::FileAlreadyExists => "file already exists",
33 Reason::FileContentNotUTF8 => "file content not utf-8",
34 Reason::Other => "other",
35 };
36 write!(f, "{}", s)
37 }
38}