kfn_rs/helpers/
file_type.rs1#[derive(Debug, Copy, Clone, PartialEq)]
3pub enum FileType {
4 SongIni,
5 Music,
6 Image,
7 Font,
8 Video,
9 INVALID,
10}
11
12pub trait ToBinary {
13 fn to_binary(&mut self) -> Vec<u8>;
14}
15
16impl From<u32> for FileType {
18 fn from(numeric: u32) -> Self {
19 match numeric {
20 1 => FileType::SongIni,
21 2 => FileType::Music,
22 3 => FileType::Image,
23 4 => FileType::Font,
24 5 => FileType::Video,
25 _ => FileType::INVALID,
26 }
27 }
28}
29
30impl Into<u32> for FileType {
31 fn into(self) -> u32 {
32 match self {
33 FileType::SongIni => 1,
34 FileType::Music => 2,
35 FileType::Image => 3,
36 FileType::Font => 4,
37 FileType::Video => 5,
38 FileType::INVALID => 0,
39 }
40 }
41}
42
43impl Default for FileType {
44 fn default() -> Self {
45 FileType::INVALID
46 }
47}