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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
//! Contains [crate::Packet] enum
use std::fmt::Debug;
use insim_core::{Decode, Encode};
use crate::insim::*;
#[derive(Debug, Clone, from_variants::FromVariants)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[non_exhaustive]
/// Enum representing all possible packets receivable via an Insim connection.
/// Each variant may either be instructional (tell LFS to do something), informational (you are
/// told something about LFS), or both.
pub enum Packet {
/// Instruction - handshake or init
Isi(Isi),
/// Information - version info
Ver(Ver),
/// Both - multi-purpose
Tiny(Tiny),
/// Both - multi-purpose
Small(Small),
/// Information - State info
Sta(Sta),
/// Instruction - Single character
Sch(Sch),
/// Instruction - State Flags Pack
Sfp(Sfp),
/// Both - Set Car Cam
Scc(Scc),
/// Both - Camera position pack
Cpp(Cpp),
/// Information - Start multiplayer
Ism(Ism),
/// Information - Message out
Mso(Mso),
/// Information - Hidden /i message
Iii(Iii),
/// Instruction - Type a message or /command
Mst(Mst),
/// Instruction - Message to connection
Mtc(Mtc),
/// Instruction - set screen mode
Mod(Mod),
/// Information - Vote notification
Vtn(Vtn),
/// Information - Race start
Rst(Rst),
/// Information - New connection
Ncn(Ncn),
/// Information - Connection left
Cnl(Cnl),
/// Information - Connection renamed
Cpr(Cpr),
/// Information - New player (player joined)
Npl(Npl),
/// Information - Player telepits
Plp(Plp),
/// Information - Player left
Pll(Pll),
/// Information - Lap time
Lap(Lap),
/// Information - Split time
Spx(Spx),
/// Information - Pit stop start
Pit(Pit),
/// Information - Pit stop finish
Psf(Psf),
/// Information - Player entered pit lane
Pla(Pla),
/// Information - Camera changed
Cch(Cch),
/// Information - Penalty
Pen(Pen),
/// Information - Take over
Toc(Toc),
/// Information - Flag
Flg(Flg),
/// Information - Player flags
Pfl(Pfl),
/// Information - Finished race - unverified result
Fin(Fin),
/// Information - Verified finish result
Res(Res),
/// Both - Player reorder
Reo(Reo),
/// Information - Node and lap
Nlp(Nlp),
/// Information - Multi-car info
Mci(Mci),
/// Instruction - Type a message
Msx(Msx),
/// Instruction - Message to local computer
Msl(Msl),
/// Information - Car reset
Crs(Crs),
/// Both - Delete or receive buttons
Bfn(Bfn),
/// Information - AutoX layout info
Axi(Axi),
/// Information - Player hit an AutoX object
Axo(Axo),
/// Instruction - Show a button
Btn(Btn),
/// Information - Button clicked
Btc(Btc),
/// Information - Button was typed into
Btt(Btt),
/// Both - Replay information
Rip(Rip),
/// Both - screenshot
Ssh(Ssh),
/// Information - contact between vehicles
Con(Con),
/// Information - Object hit
Obh(Obh),
/// Information - Hot lap validity violation
Hlv(Hlv),
/// Instruction - Restrict player vehicles
Plc(Plc),
/// Both - AutoX - multiple object
Axm(Axm),
/// Information - Admin command report
Acr(Acr),
/// Instruction - Handicap
Hcp(Hcp),
/// Information - New connection information
Nci(Nci),
/// Instruction - Join reply response
Jrr(Jrr),
/// Information - report insim checkpoint/circle
Uco(Uco),
/// Instruction - Object control
Oco(Oco),
/// Instruction - Multi-purpose, target to connection
Ttc(Ttc),
/// Information - Player selected vehicle
Slc(Slc),
/// Information - Vehicle changed state
Csc(Csc),
/// Information - Connection interface mode
Cim(Cim),
/// Both - Set mods a player is allowed
Mal(Mal),
/// Both - Set/receive player handicap
Plh(Plh),
/// Both - Set/receive player bans
Ipb(Ipb),
/// Instruction - Set AI control value
Aic(Aic),
/// Information - AI information
Aii(Aii),
}
impl Default for Packet {
fn default() -> Self {
Self::Tiny(Tiny::default())
}
}
impl Packet {
/// Hint at the possible *minimum* size of a packet, so that when we encode it, it can pre-allocate a
/// ballpark buffer.
/// It must not be trusted. An incorrect implementation of size_hint() should not lead to memory safety violations.
pub fn size_hint(&self) -> usize {
// TODO: For some of these packets we can be more intelligent.
match self {
Packet::Isi(_) => 44,
Packet::Ver(_) => 20,
Packet::Small(_) => 8,
Packet::Sta(_) => 28,
Packet::Sch(_) => 8,
Packet::Sfp(_) => 8,
Packet::Scc(_) => 8,
Packet::Cpp(_) => 32,
Packet::Ism(_) => 40,
Packet::Mso(_) => 12,
Packet::Iii(_) => 12,
Packet::Mst(_) => 68,
Packet::Mtc(_) => 12,
Packet::Mod(_) => 20,
Packet::Vtn(_) => 8,
Packet::Rst(_) => 28,
Packet::Ncn(_) => 56,
Packet::Cnl(_) => 8,
Packet::Cpr(_) => 36,
Packet::Npl(_) => 76,
Packet::Lap(_) => 20,
Packet::Spx(_) => 16,
Packet::Pit(_) => 24,
Packet::Psf(_) => 12,
Packet::Pla(_) => 8,
Packet::Cch(_) => 8,
Packet::Pen(_) => 8,
Packet::Toc(_) => 8,
Packet::Flg(_) => 8,
Packet::Pfl(_) => 8,
Packet::Fin(_) => 20,
Packet::Res(_) => 86,
Packet::Reo(_) => 44,
Packet::Nlp(_) => 10,
Packet::Mci(_) => 32,
Packet::Msx(_) => 100,
Packet::Msl(_) => 132,
Packet::Crs(_) => 4,
Packet::Bfn(_) => 8,
Packet::Axi(_) => 40,
Packet::Axo(_) => 4,
Packet::Btn(_) => 16,
Packet::Btc(_) => 8,
Packet::Btt(_) => 104,
Packet::Rip(_) => 80,
Packet::Ssh(_) => 40,
Packet::Con(_) => 40,
Packet::Obh(_) => 24,
Packet::Hlv(_) => 16,
Packet::Plc(_) => 8,
Packet::Axm(_) => 16,
Packet::Acr(_) => 12,
Packet::Hcp(_) => 68,
Packet::Nci(_) => 16,
Packet::Jrr(_) => 16,
Packet::Uco(_) => 28,
Packet::Oco(_) => 8,
Packet::Ttc(_) => 8,
Packet::Slc(_) => 8,
Packet::Csc(_) => 20,
Packet::Cim(_) => 8,
Packet::Mal(_) => 12,
Packet::Aic(i) => 4 + (i.inputs.len() * 4),
Packet::Aii(_) => 96,
_ => {
// a sensible default for everything else
4
},
}
}
}
/// Helper method to assist in converting the inner part of a [Packet] variant into [Packet] with a
/// request identifier set. Mostly useful for things like [Packet::Tiny].
pub trait WithRequestId
where
Self: std::fmt::Debug,
{
/// Convert something into a Packet with a request identifier
fn with_request_id<R: Into<crate::identifiers::RequestId>>(
self,
reqi: R,
) -> impl Into<crate::Packet> + std::fmt::Debug;
}
impl WithRequestId for Packet {
fn with_request_id<R: Into<crate::identifiers::RequestId>>(
mut self,
reqi: R,
) -> impl Into<crate::Packet> + std::fmt::Debug {
match &mut self {
Packet::Isi(i) => i.reqi = reqi.into(),
Packet::Ver(i) => i.reqi = reqi.into(),
Packet::Tiny(i) => i.reqi = reqi.into(),
Packet::Small(i) => i.reqi = reqi.into(),
Packet::Sta(i) => i.reqi = reqi.into(),
Packet::Sch(i) => i.reqi = reqi.into(),
Packet::Sfp(i) => i.reqi = reqi.into(),
Packet::Scc(i) => i.reqi = reqi.into(),
Packet::Cpp(i) => i.reqi = reqi.into(),
Packet::Ism(i) => i.reqi = reqi.into(),
Packet::Mso(i) => i.reqi = reqi.into(),
Packet::Iii(i) => i.reqi = reqi.into(),
Packet::Mst(i) => i.reqi = reqi.into(),
Packet::Mtc(i) => i.reqi = reqi.into(),
Packet::Mod(i) => i.reqi = reqi.into(),
Packet::Vtn(i) => i.reqi = reqi.into(),
Packet::Rst(i) => i.reqi = reqi.into(),
Packet::Ncn(i) => i.reqi = reqi.into(),
Packet::Cnl(i) => i.reqi = reqi.into(),
Packet::Cpr(i) => i.reqi = reqi.into(),
Packet::Npl(i) => i.reqi = reqi.into(),
Packet::Plp(i) => i.reqi = reqi.into(),
Packet::Pll(i) => i.reqi = reqi.into(),
Packet::Lap(i) => i.reqi = reqi.into(),
Packet::Spx(i) => i.reqi = reqi.into(),
Packet::Pit(i) => i.reqi = reqi.into(),
Packet::Psf(i) => i.reqi = reqi.into(),
Packet::Pla(i) => i.reqi = reqi.into(),
Packet::Cch(i) => i.reqi = reqi.into(),
Packet::Pen(i) => i.reqi = reqi.into(),
Packet::Toc(i) => i.reqi = reqi.into(),
Packet::Flg(i) => i.reqi = reqi.into(),
Packet::Pfl(i) => i.reqi = reqi.into(),
Packet::Fin(i) => i.reqi = reqi.into(),
Packet::Res(i) => i.reqi = reqi.into(),
Packet::Reo(i) => i.reqi = reqi.into(),
Packet::Nlp(i) => i.reqi = reqi.into(),
Packet::Mci(i) => i.reqi = reqi.into(),
Packet::Msx(i) => i.reqi = reqi.into(),
Packet::Msl(i) => i.reqi = reqi.into(),
Packet::Crs(i) => i.reqi = reqi.into(),
Packet::Bfn(i) => i.reqi = reqi.into(),
Packet::Axi(i) => i.reqi = reqi.into(),
Packet::Axo(i) => i.reqi = reqi.into(),
Packet::Btn(i) => i.reqi = reqi.into(),
Packet::Btc(i) => i.reqi = reqi.into(),
Packet::Btt(i) => i.reqi = reqi.into(),
Packet::Rip(i) => i.reqi = reqi.into(),
Packet::Ssh(i) => i.reqi = reqi.into(),
Packet::Con(i) => i.reqi = reqi.into(),
Packet::Obh(i) => i.reqi = reqi.into(),
Packet::Hlv(i) => i.reqi = reqi.into(),
Packet::Plc(i) => i.reqi = reqi.into(),
Packet::Axm(i) => i.reqi = reqi.into(),
Packet::Acr(i) => i.reqi = reqi.into(),
Packet::Hcp(i) => i.reqi = reqi.into(),
Packet::Nci(i) => i.reqi = reqi.into(),
Packet::Jrr(i) => i.reqi = reqi.into(),
Packet::Uco(i) => i.reqi = reqi.into(),
Packet::Oco(i) => i.reqi = reqi.into(),
Packet::Ttc(i) => i.reqi = reqi.into(),
Packet::Slc(i) => i.reqi = reqi.into(),
Packet::Csc(i) => i.reqi = reqi.into(),
Packet::Cim(i) => i.reqi = reqi.into(),
Packet::Mal(i) => i.reqi = reqi.into(),
Packet::Plh(i) => i.reqi = reqi.into(),
Packet::Ipb(i) => i.reqi = reqi.into(),
Packet::Aic(i) => i.reqi = reqi.into(),
Packet::Aii(i) => i.reqi = reqi.into(),
};
self
}
}
impl Decode for Packet {
fn decode(buf: &mut bytes::Bytes) -> Result<Self, insim_core::DecodeError> {
let discrimator = u8::decode(buf)?;
let packet = match discrimator {
1 => Self::Isi(Isi::decode(buf)?),
2 => Self::Ver(Ver::decode(buf)?),
3 => Self::Tiny(Tiny::decode(buf)?),
4 => Self::Small(Small::decode(buf)?),
5 => Self::Sta(Sta::decode(buf)?),
6 => Self::Sch(Sch::decode(buf)?),
7 => Self::Sfp(Sfp::decode(buf)?),
8 => Self::Scc(Scc::decode(buf)?),
9 => Self::Cpp(Cpp::decode(buf)?),
10 => Self::Ism(Ism::decode(buf)?),
11 => Self::Mso(Mso::decode(buf)?),
12 => Self::Iii(Iii::decode(buf)?),
13 => Self::Mst(Mst::decode(buf)?),
14 => Self::Mtc(Mtc::decode(buf)?),
15 => Self::Mod(Mod::decode(buf)?),
16 => Self::Vtn(Vtn::decode(buf)?),
17 => Self::Rst(Rst::decode(buf)?),
18 => Self::Ncn(Ncn::decode(buf)?),
19 => Self::Cnl(Cnl::decode(buf)?),
20 => Self::Cpr(Cpr::decode(buf)?),
21 => Self::Npl(Npl::decode(buf)?),
22 => Self::Plp(Plp::decode(buf)?),
23 => Self::Pll(Pll::decode(buf)?),
24 => Self::Lap(Lap::decode(buf)?),
25 => Self::Spx(Spx::decode(buf)?),
26 => Self::Pit(Pit::decode(buf)?),
27 => Self::Psf(Psf::decode(buf)?),
28 => Self::Pla(Pla::decode(buf)?),
29 => Self::Cch(Cch::decode(buf)?),
30 => Self::Pen(Pen::decode(buf)?),
31 => Self::Toc(Toc::decode(buf)?),
32 => Self::Flg(Flg::decode(buf)?),
33 => Self::Pfl(Pfl::decode(buf)?),
34 => Self::Fin(Fin::decode(buf)?),
35 => Self::Res(Res::decode(buf)?),
36 => Self::Reo(Reo::decode(buf)?),
37 => Self::Nlp(Nlp::decode(buf)?),
38 => Self::Mci(Mci::decode(buf)?),
39 => Self::Msx(Msx::decode(buf)?),
40 => Self::Msl(Msl::decode(buf)?),
41 => Self::Crs(Crs::decode(buf)?),
42 => Self::Bfn(Bfn::decode(buf)?),
43 => Self::Axi(Axi::decode(buf)?),
44 => Self::Axo(Axo::decode(buf)?),
45 => Self::Btn(Btn::decode(buf)?),
46 => Self::Btc(Btc::decode(buf)?),
47 => Self::Btt(Btt::decode(buf)?),
48 => Self::Rip(Rip::decode(buf)?),
49 => Self::Ssh(Ssh::decode(buf)?),
50 => Self::Con(Con::decode(buf)?),
51 => Self::Obh(Obh::decode(buf)?),
52 => Self::Hlv(Hlv::decode(buf)?),
53 => Self::Plc(Plc::decode(buf)?),
54 => Self::Axm(Axm::decode(buf)?),
55 => Self::Acr(Acr::decode(buf)?),
56 => Self::Hcp(Hcp::decode(buf)?),
57 => Self::Nci(Nci::decode(buf)?),
58 => Self::Jrr(Jrr::decode(buf)?),
59 => Self::Uco(Uco::decode(buf)?),
60 => Self::Oco(Oco::decode(buf)?),
61 => Self::Ttc(Ttc::decode(buf)?),
62 => Self::Slc(Slc::decode(buf)?),
63 => Self::Csc(Csc::decode(buf)?),
64 => Self::Cim(Cim::decode(buf)?),
65 => Self::Mal(Mal::decode(buf)?),
66 => Self::Plh(Plh::decode(buf)?),
67 => Self::Ipb(Ipb::decode(buf)?),
68 => Self::Aic(Aic::decode(buf)?),
69 => Self::Aii(Aii::decode(buf)?),
i => return Err(insim_core::DecodeError::NoVariantMatch { found: i.into() }),
};
Ok(packet)
}
}
impl Encode for Packet {
fn encode(&self, buf: &mut bytes::BytesMut) -> Result<(), insim_core::EncodeError> {
match self {
Self::Isi(i) => {
1_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Ver(i) => {
2_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Tiny(i) => {
3_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Small(i) => {
4_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Sta(i) => {
5_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Sch(i) => {
6_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Sfp(i) => {
7_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Scc(i) => {
8_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Cpp(i) => {
9_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Ism(i) => {
10_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Mso(i) => {
11_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Iii(i) => {
12_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Mst(i) => {
13_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Mtc(i) => {
14_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Mod(i) => {
15_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Vtn(i) => {
16_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Rst(i) => {
17_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Ncn(i) => {
18_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Cnl(i) => {
19_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Cpr(i) => {
20_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Npl(i) => {
21_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Plp(i) => {
22_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Pll(i) => {
23_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Lap(i) => {
24_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Spx(i) => {
25_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Pit(i) => {
26_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Psf(i) => {
27_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Pla(i) => {
28_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Cch(i) => {
29_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Pen(i) => {
30_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Toc(i) => {
31_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Flg(i) => {
32_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Pfl(i) => {
33_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Fin(i) => {
34_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Res(i) => {
35_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Reo(i) => {
36_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Nlp(i) => {
37_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Mci(i) => {
38_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Msx(i) => {
39_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Msl(i) => {
40_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Crs(i) => {
41_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Bfn(i) => {
42_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Axi(i) => {
43_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Axo(i) => {
44_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Btn(i) => {
45_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Btc(i) => {
46_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Btt(i) => {
47_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Rip(i) => {
48_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Ssh(i) => {
49_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Con(i) => {
50_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Obh(i) => {
51_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Hlv(i) => {
52_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Plc(i) => {
53_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Axm(i) => {
54_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Acr(i) => {
55_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Hcp(i) => {
56_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Nci(i) => {
57_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Jrr(i) => {
58_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Uco(i) => {
59_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Oco(i) => {
60_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Ttc(i) => {
61_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Slc(i) => {
62_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Csc(i) => {
63_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Cim(i) => {
64_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Mal(i) => {
65_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Plh(i) => {
66_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Ipb(i) => {
67_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Aic(i) => {
68_u8.encode(buf)?;
i.encode(buf)?;
},
Self::Aii(i) => {
69_u8.encode(buf)?;
i.encode(buf)?;
},
};
Ok(())
}
}