1use crate::entity::entity_impl;
3use core::u32;
4
5#[derive(
7 Copy,
8 Clone,
9 PartialEq,
10 Eq,
11 Hash,
12 PartialOrd,
13 Ord,
14 Debug,
15 rkyv::Serialize,
16 rkyv::Deserialize,
17 rkyv::Archive,
18)]
19#[archive(as = "Self")]
20#[repr(transparent)]
21pub struct LocalFunctionIndex(u32);
22entity_impl!(LocalFunctionIndex);
23
24#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
26pub struct LocalTableIndex(u32);
27entity_impl!(LocalTableIndex);
28
29#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
31pub struct LocalMemoryIndex(u32);
32entity_impl!(LocalMemoryIndex);
33
34#[derive(
36 Copy,
37 Clone,
38 PartialEq,
39 Eq,
40 Hash,
41 PartialOrd,
42 Ord,
43 Debug,
44 rkyv::Serialize,
45 rkyv::Deserialize,
46 rkyv::Archive,
47)]
48#[archive(as = "Self")]
49#[repr(transparent)]
50pub struct LocalGlobalIndex(u32);
51entity_impl!(LocalGlobalIndex);
52
53#[derive(
55 Copy,
56 Clone,
57 PartialEq,
58 Eq,
59 Hash,
60 PartialOrd,
61 Ord,
62 Debug,
63 rkyv::Serialize,
64 rkyv::Deserialize,
65 rkyv::Archive,
66)]
67#[archive(as = "Self")]
68#[repr(transparent)]
69pub struct FunctionIndex(u32);
70entity_impl!(FunctionIndex);
71
72#[derive(
74 Copy,
75 Clone,
76 PartialEq,
77 Eq,
78 Hash,
79 PartialOrd,
80 Ord,
81 Debug,
82 rkyv::Serialize,
83 rkyv::Deserialize,
84 rkyv::Archive,
85)]
86#[archive(as = "Self")]
87#[repr(transparent)]
88pub struct TableIndex(u32);
89entity_impl!(TableIndex);
90
91#[derive(
93 Copy,
94 Clone,
95 PartialEq,
96 Eq,
97 Hash,
98 PartialOrd,
99 Ord,
100 Debug,
101 rkyv::Serialize,
102 rkyv::Deserialize,
103 rkyv::Archive,
104)]
105#[archive(as = "Self")]
106#[repr(transparent)]
107pub struct GlobalIndex(u32);
108entity_impl!(GlobalIndex);
109
110#[derive(
112 Copy,
113 Clone,
114 PartialEq,
115 Eq,
116 Hash,
117 PartialOrd,
118 Ord,
119 Debug,
120 rkyv::Serialize,
121 rkyv::Deserialize,
122 rkyv::Archive,
123)]
124#[archive(as = "Self")]
125#[repr(transparent)]
126pub struct MemoryIndex(u32);
127entity_impl!(MemoryIndex);
128
129#[derive(
131 Copy,
132 Clone,
133 PartialEq,
134 Eq,
135 Hash,
136 PartialOrd,
137 Ord,
138 Debug,
139 rkyv::Serialize,
140 rkyv::Deserialize,
141 rkyv::Archive,
142)]
143#[archive(as = "Self")]
144#[repr(transparent)]
145pub struct SignatureIndex(u32);
146entity_impl!(SignatureIndex);
147
148#[derive(
150 Copy,
151 Clone,
152 PartialEq,
153 Eq,
154 Hash,
155 PartialOrd,
156 Ord,
157 Debug,
158 rkyv::Serialize,
159 rkyv::Deserialize,
160 rkyv::Archive,
161)]
162#[archive(as = "Self")]
163#[repr(transparent)]
164pub struct DataIndex(u32);
165entity_impl!(DataIndex);
166
167#[derive(
169 Copy,
170 Clone,
171 PartialEq,
172 Eq,
173 Hash,
174 PartialOrd,
175 Ord,
176 Debug,
177 rkyv::Serialize,
178 rkyv::Deserialize,
179 rkyv::Archive,
180)]
181#[archive(as = "Self")]
182#[repr(transparent)]
183pub struct ElemIndex(u32);
184entity_impl!(ElemIndex);
185
186#[derive(
188 Copy,
189 Clone,
190 PartialEq,
191 Eq,
192 Hash,
193 PartialOrd,
194 Ord,
195 Debug,
196 rkyv::Serialize,
197 rkyv::Deserialize,
198 rkyv::Archive,
199)]
200#[archive(as = "Self")]
201#[repr(transparent)]
202pub struct CustomSectionIndex(u32);
203entity_impl!(CustomSectionIndex);
204
205#[derive(
207 Clone,
208 Debug,
209 Hash,
210 PartialEq,
211 Eq,
212 PartialOrd,
213 Ord,
214 rkyv::Serialize,
215 rkyv::Deserialize,
216 rkyv::Archive,
217)]
218#[archive(as = "Self")]
219#[repr(u8)]
220pub enum ExportIndex {
221 Function(FunctionIndex),
223 Table(TableIndex),
225 Memory(MemoryIndex),
227 Global(GlobalIndex),
229}
230
231#[derive(
233 Clone,
234 Debug,
235 Hash,
236 PartialEq,
237 Eq,
238 PartialOrd,
239 Ord,
240 rkyv::Serialize,
241 rkyv::Deserialize,
242 rkyv::Archive,
243)]
244#[archive(as = "Self")]
245#[repr(u8)]
246pub enum ImportIndex {
247 Function(FunctionIndex),
249 Table(TableIndex),
251 Memory(MemoryIndex),
253 Global(GlobalIndex),
255}