smash_arc/
table_indices.rs

1use binrw::BinRead;
2
3#[repr(transparent)]
4#[derive(BinRead, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub struct FilePathIdx(pub u32);
6
7impl From<FilePathIdx> for usize {
8    fn from(index: FilePathIdx) -> Self {
9        index.0 as usize
10    }
11}
12
13impl From<u32> for FilePathIdx {
14    fn from(index: u32) -> Self {
15        FilePathIdx(index)
16    }
17}
18
19impl From<usize> for FilePathIdx {
20    fn from(index: usize) -> Self {
21        FilePathIdx(index as u32)
22    }
23}
24
25#[repr(transparent)]
26#[derive(BinRead, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
27pub struct FileInfoIdx(pub u32);
28
29impl From<FileInfoIdx> for usize {
30    fn from(index: FileInfoIdx) -> Self {
31        index.0 as usize
32    }
33}
34
35impl From<u32> for FileInfoIdx {
36    fn from(index: u32) -> Self {
37        FileInfoIdx(index)
38    }
39}
40
41impl From<FileInfoIdx> for u32 {
42    fn from(index: FileInfoIdx) -> Self {
43        index.0
44    }
45}
46
47impl From<usize> for FileInfoIdx {
48    fn from(index: usize) -> Self {
49        FileInfoIdx(index as u32)
50    }
51}
52
53#[repr(transparent)]
54#[derive(BinRead, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
55pub struct FileInfoIndiceIdx(pub u32);
56
57impl From<FileInfoIndiceIdx> for usize {
58    fn from(index: FileInfoIndiceIdx) -> Self {
59        index.0 as usize
60    }
61}
62
63impl From<u32> for FileInfoIndiceIdx {
64    fn from(index: u32) -> Self {
65        FileInfoIndiceIdx(index)
66    }
67}
68
69impl From<FileInfoIndiceIdx> for u32 {
70    fn from(index: FileInfoIndiceIdx) -> Self {
71        index.0
72    }
73}
74
75impl From<usize> for FileInfoIndiceIdx {
76    fn from(index: usize) -> Self {
77        FileInfoIndiceIdx(index as u32)
78    }
79}
80
81#[repr(transparent)]
82#[derive(BinRead, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
83pub struct InfoToDataIdx(pub u32);
84
85impl From<InfoToDataIdx> for usize {
86    fn from(index: InfoToDataIdx) -> Self {
87        index.0 as usize
88    }
89}
90
91impl From<u32> for InfoToDataIdx {
92    fn from(index: u32) -> Self {
93        InfoToDataIdx(index)
94    }
95}
96
97impl From<usize> for InfoToDataIdx {
98    fn from(index: usize) -> Self {
99        InfoToDataIdx(index as u32)
100    }
101}
102
103#[repr(transparent)]
104#[derive(BinRead, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
105pub struct FileDataIdx(pub u32);
106
107impl From<FileDataIdx> for usize {
108    fn from(index: FileDataIdx) -> Self {
109        index.0 as usize
110    }
111}
112
113impl From<u32> for FileDataIdx {
114    fn from(index: u32) -> Self {
115        FileDataIdx(index)
116    }
117}
118
119impl From<usize> for FileDataIdx {
120    fn from(index: usize) -> Self {
121        FileDataIdx(index as u32)
122    }
123}