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#[rkyv(derive(Copy, Clone, PartialEq, Eq))]
20#[repr(transparent)]
21pub struct LocalFunctionIndex(u32);
22entity_impl!(LocalFunctionIndex);
23entity_impl!(ArchivedLocalFunctionIndex);
24
25#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
27pub struct LocalTableIndex(u32);
28entity_impl!(LocalTableIndex);
29
30#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
32pub struct LocalMemoryIndex(u32);
33entity_impl!(LocalMemoryIndex);
34
35#[derive(
37 Copy,
38 Clone,
39 PartialEq,
40 Eq,
41 Hash,
42 PartialOrd,
43 Ord,
44 Debug,
45 rkyv::Serialize,
46 rkyv::Deserialize,
47 rkyv::Archive,
48)]
49#[rkyv(derive(Copy, Clone, PartialEq, Eq))]
50#[repr(transparent)]
51pub struct LocalGlobalIndex(u32);
52entity_impl!(LocalGlobalIndex);
53entity_impl!(ArchivedLocalGlobalIndex);
54
55#[derive(
57 Copy,
58 Clone,
59 PartialEq,
60 Eq,
61 Hash,
62 PartialOrd,
63 Ord,
64 Debug,
65 rkyv::Serialize,
66 rkyv::Deserialize,
67 rkyv::Archive,
68)]
69#[rkyv(derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash))]
70#[repr(transparent)]
71pub struct FunctionIndex(u32);
72entity_impl!(FunctionIndex);
73entity_impl!(ArchivedFunctionIndex);
74
75#[derive(
77 Copy,
78 Clone,
79 PartialEq,
80 Eq,
81 Hash,
82 PartialOrd,
83 Ord,
84 Debug,
85 rkyv::Serialize,
86 rkyv::Deserialize,
87 rkyv::Archive,
88)]
89#[rkyv(derive(Copy, Clone, PartialEq, Eq))]
90#[repr(transparent)]
91pub struct TableIndex(u32);
92entity_impl!(TableIndex);
93entity_impl!(ArchivedTableIndex);
94
95#[derive(
97 Copy,
98 Clone,
99 PartialEq,
100 Eq,
101 Hash,
102 PartialOrd,
103 Ord,
104 Debug,
105 rkyv::Serialize,
106 rkyv::Deserialize,
107 rkyv::Archive,
108)]
109#[rkyv(derive(Copy, Clone, PartialEq, Eq))]
110#[repr(transparent)]
111pub struct GlobalIndex(u32);
112entity_impl!(GlobalIndex);
113entity_impl!(ArchivedGlobalIndex);
114
115#[derive(
117 Copy,
118 Clone,
119 PartialEq,
120 Eq,
121 Hash,
122 PartialOrd,
123 Ord,
124 Debug,
125 rkyv::Serialize,
126 rkyv::Deserialize,
127 rkyv::Archive,
128)]
129#[rkyv(derive(Copy, Clone, PartialEq, Eq))]
130#[repr(transparent)]
131pub struct MemoryIndex(u32);
132entity_impl!(MemoryIndex);
133entity_impl!(ArchivedMemoryIndex);
134
135#[derive(
137 Copy,
138 Clone,
139 PartialEq,
140 Eq,
141 Hash,
142 PartialOrd,
143 Ord,
144 Debug,
145 rkyv::Serialize,
146 rkyv::Deserialize,
147 rkyv::Archive,
148)]
149#[rkyv(derive(Copy, Clone, PartialEq, Eq))]
150#[repr(transparent)]
151pub struct SignatureIndex(u32);
152entity_impl!(SignatureIndex);
153entity_impl!(ArchivedSignatureIndex);
154
155#[derive(
157 Copy,
158 Clone,
159 PartialEq,
160 Eq,
161 Hash,
162 PartialOrd,
163 Ord,
164 Debug,
165 rkyv::Serialize,
166 rkyv::Deserialize,
167 rkyv::Archive,
168)]
169#[repr(transparent)]
170#[rkyv(derive(PartialOrd, Ord, PartialEq, Eq))]
171pub struct DataIndex(u32);
172entity_impl!(DataIndex);
173
174#[derive(
176 Copy,
177 Clone,
178 PartialEq,
179 Eq,
180 Hash,
181 PartialOrd,
182 Ord,
183 Debug,
184 rkyv::Serialize,
185 rkyv::Deserialize,
186 rkyv::Archive,
187)]
188#[repr(transparent)]
189#[rkyv(derive(PartialOrd, Ord, PartialEq, Eq))]
190pub struct ElemIndex(u32);
191entity_impl!(ElemIndex);
192
193#[derive(
195 Copy,
196 Clone,
197 PartialEq,
198 Eq,
199 Hash,
200 PartialOrd,
201 Ord,
202 Debug,
203 rkyv::Serialize,
204 rkyv::Deserialize,
205 rkyv::Archive,
206)]
207#[repr(transparent)]
208pub struct CustomSectionIndex(u32);
209entity_impl!(CustomSectionIndex);
210
211#[derive(
213 Clone,
214 Debug,
215 Hash,
216 PartialEq,
217 Eq,
218 PartialOrd,
219 Ord,
220 rkyv::Serialize,
221 rkyv::Deserialize,
222 rkyv::Archive,
223)]
224#[repr(u8)]
225pub enum ExportIndex {
226 Function(FunctionIndex),
228 Table(TableIndex),
230 Memory(MemoryIndex),
232 Global(GlobalIndex),
234}
235
236#[derive(
238 Clone,
239 Debug,
240 Hash,
241 PartialEq,
242 Eq,
243 PartialOrd,
244 Ord,
245 rkyv::Serialize,
246 rkyv::Deserialize,
247 rkyv::Archive,
248)]
249#[repr(u8)]
250pub enum ImportIndex {
251 Function(FunctionIndex),
253 Table(TableIndex),
255 Memory(MemoryIndex),
257 Global(GlobalIndex),
259}