1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
#![deny(unsafe_code)]
#![deny(missing_docs)]
#![deny(unreachable_pub)]
#![deny(missing_debug_implementations)]
use snafu::{Backtrace, Snafu};
use std::borrow::{Borrow, BorrowMut};
pub mod london {
include!(concat!(env!("OUT_DIR"), "/london.rs"));
}
#[derive(Debug, Snafu)]
pub struct FromStrError {
backtrace: Backtrace,
mnemonic: String,
}
#[derive(Debug, Snafu)]
pub enum FromSliceError<E>
where
E: 'static + std::fmt::Display + std::error::Error,
{
#[snafu(context(false))]
TryInto {
source: E,
backtrace: Backtrace,
},
NoImmediate {
backtrace: Backtrace,
},
}
pub trait Immediate<const N: usize> {}
impl<const N: usize> Immediate<N> for [u8; N] {}
impl<const N: usize> Immediate<N> for () {}
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub enum Void {}
impl<const N: usize> Immediate<N> for Void {}
pub trait Immediates {
type ImmediateRef: ?Sized;
type Immediate: Borrow<Self::ImmediateRef> + BorrowMut<Self::ImmediateRef>;
type P1: Immediate<1>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P2: Immediate<2>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P3: Immediate<3>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P4: Immediate<4>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P5: Immediate<5>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P6: Immediate<6>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P7: Immediate<7>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P8: Immediate<8>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P9: Immediate<9>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P10: Immediate<10>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P11: Immediate<11>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P12: Immediate<12>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P13: Immediate<13>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P14: Immediate<14>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P15: Immediate<15>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P16: Immediate<16>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P17: Immediate<17>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P18: Immediate<18>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P19: Immediate<19>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P20: Immediate<20>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P21: Immediate<21>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P22: Immediate<22>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P23: Immediate<23>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P24: Immediate<24>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P25: Immediate<25>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P26: Immediate<26>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P27: Immediate<27>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P28: Immediate<28>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P29: Immediate<29>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P30: Immediate<30>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P31: Immediate<31>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
type P32: Immediate<32>
+ Borrow<Self::ImmediateRef>
+ BorrowMut<Self::ImmediateRef>
+ Into<Self::Immediate>;
}
impl Immediates for () {
type ImmediateRef = ();
type Immediate = ();
type P1 = ();
type P2 = ();
type P3 = ();
type P4 = ();
type P5 = ();
type P6 = ();
type P7 = ();
type P8 = ();
type P9 = ();
type P10 = ();
type P11 = ();
type P12 = ();
type P13 = ();
type P14 = ();
type P15 = ();
type P16 = ();
type P17 = ();
type P18 = ();
type P19 = ();
type P20 = ();
type P21 = ();
type P22 = ();
type P23 = ();
type P24 = ();
type P25 = ();
type P26 = ();
type P27 = ();
type P28 = ();
type P29 = ();
type P30 = ();
type P31 = ();
type P32 = ();
}
impl Immediates for [u8] {
type ImmediateRef = [u8];
type Immediate = Vec<u8>;
type P1 = [u8; 1];
type P2 = [u8; 2];
type P3 = [u8; 3];
type P4 = [u8; 4];
type P5 = [u8; 5];
type P6 = [u8; 6];
type P7 = [u8; 7];
type P8 = [u8; 8];
type P9 = [u8; 9];
type P10 = [u8; 10];
type P11 = [u8; 11];
type P12 = [u8; 12];
type P13 = [u8; 13];
type P14 = [u8; 14];
type P15 = [u8; 15];
type P16 = [u8; 16];
type P17 = [u8; 17];
type P18 = [u8; 18];
type P19 = [u8; 19];
type P20 = [u8; 20];
type P21 = [u8; 21];
type P22 = [u8; 22];
type P23 = [u8; 23];
type P24 = [u8; 24];
type P25 = [u8; 25];
type P26 = [u8; 26];
type P27 = [u8; 27];
type P28 = [u8; 28];
type P29 = [u8; 29];
type P30 = [u8; 30];
type P31 = [u8; 31];
type P32 = [u8; 32];
}