sconfig/types.rs
1use std::fmt::Display;
2
3pub enum FileType {
4 Toml,
5 Json,
6}
7
8impl Display for FileType {
9 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10 let suffix = match self {
11 FileType::Toml => "toml",
12 FileType::Json => "json",
13 };
14 write!(f, "{}", suffix)
15 }
16}
17
18#[cfg(test)]
19mod tests {
20 use super::FileType;
21
22 #[test]
23 fn test_display() {
24 assert_eq!("toml", FileType::Toml.to_string());
25 }
26}