-
Notifications
You must be signed in to change notification settings - Fork 219
/
protocol_generated.rs
3387 lines (3132 loc) · 105 KB
/
protocol_generated.rs
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
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// automatically generated by the FlatBuffers compiler, do not modify
pub mod ckb {
#![allow(dead_code)]
#![allow(unused_imports)]
use std::mem;
use std::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::EndianScalar;
pub mod protocol {
#![allow(dead_code)]
#![allow(unused_imports)]
use std::mem;
use std::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::EndianScalar;
#[allow(non_camel_case_types)]
#[repr(u8)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum SyncPayload {
NONE = 0,
GetHeaders = 1,
Headers = 2,
GetBlocks = 3,
Block = 4,
SetFilter = 5,
AddFilter = 6,
ClearFilter = 7,
FilteredBlock = 8,
}
const ENUM_MIN_SYNC_PAYLOAD: u8 = 0;
const ENUM_MAX_SYNC_PAYLOAD: u8 = 8;
impl<'a> flatbuffers::Follow<'a> for SyncPayload {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
flatbuffers::read_scalar_at::<Self>(buf, loc)
}
}
impl flatbuffers::EndianScalar for SyncPayload {
#[inline]
fn to_little_endian(self) -> Self {
let n = u8::to_le(self as u8);
let p = &n as *const u8 as *const SyncPayload;
unsafe { *p }
}
#[inline]
fn from_little_endian(self) -> Self {
let n = u8::from_le(self as u8);
let p = &n as *const u8 as *const SyncPayload;
unsafe { *p }
}
}
impl flatbuffers::Push for SyncPayload {
type Output = SyncPayload;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
flatbuffers::emplace_scalar::<SyncPayload>(dst, *self);
}
}
#[allow(non_camel_case_types)]
const ENUM_VALUES_SYNC_PAYLOAD:[SyncPayload; 9] = [
SyncPayload::NONE,
SyncPayload::GetHeaders,
SyncPayload::Headers,
SyncPayload::GetBlocks,
SyncPayload::Block,
SyncPayload::SetFilter,
SyncPayload::AddFilter,
SyncPayload::ClearFilter,
SyncPayload::FilteredBlock
];
#[allow(non_camel_case_types)]
const ENUM_NAMES_SYNC_PAYLOAD:[&'static str; 9] = [
"NONE",
"GetHeaders",
"Headers",
"GetBlocks",
"Block",
"SetFilter",
"AddFilter",
"ClearFilter",
"FilteredBlock"
];
pub fn enum_name_sync_payload(e: SyncPayload) -> &'static str {
let index: usize = e as usize;
ENUM_NAMES_SYNC_PAYLOAD[index]
}
pub struct SyncPayloadUnionTableOffset {}
#[allow(non_camel_case_types)]
#[repr(u8)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum RelayPayload {
NONE = 0,
CompactBlock = 1,
ValidTransaction = 2,
GetBlockTransactions = 3,
BlockTransactions = 4,
GetBlockProposal = 5,
BlockProposal = 6,
}
const ENUM_MIN_RELAY_PAYLOAD: u8 = 0;
const ENUM_MAX_RELAY_PAYLOAD: u8 = 6;
impl<'a> flatbuffers::Follow<'a> for RelayPayload {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
flatbuffers::read_scalar_at::<Self>(buf, loc)
}
}
impl flatbuffers::EndianScalar for RelayPayload {
#[inline]
fn to_little_endian(self) -> Self {
let n = u8::to_le(self as u8);
let p = &n as *const u8 as *const RelayPayload;
unsafe { *p }
}
#[inline]
fn from_little_endian(self) -> Self {
let n = u8::from_le(self as u8);
let p = &n as *const u8 as *const RelayPayload;
unsafe { *p }
}
}
impl flatbuffers::Push for RelayPayload {
type Output = RelayPayload;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
flatbuffers::emplace_scalar::<RelayPayload>(dst, *self);
}
}
#[allow(non_camel_case_types)]
const ENUM_VALUES_RELAY_PAYLOAD:[RelayPayload; 7] = [
RelayPayload::NONE,
RelayPayload::CompactBlock,
RelayPayload::ValidTransaction,
RelayPayload::GetBlockTransactions,
RelayPayload::BlockTransactions,
RelayPayload::GetBlockProposal,
RelayPayload::BlockProposal
];
#[allow(non_camel_case_types)]
const ENUM_NAMES_RELAY_PAYLOAD:[&'static str; 7] = [
"NONE",
"CompactBlock",
"ValidTransaction",
"GetBlockTransactions",
"BlockTransactions",
"GetBlockProposal",
"BlockProposal"
];
pub fn enum_name_relay_payload(e: RelayPayload) -> &'static str {
let index: usize = e as usize;
ENUM_NAMES_RELAY_PAYLOAD[index]
}
pub struct RelayPayloadUnionTableOffset {}
// struct ProposalShortId, aligned to 1
#[repr(C, align(1))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ProposalShortId {
u0_: u8,
u1_: u8,
u2_: u8,
u3_: u8,
u4_: u8,
u5_: u8,
u6_: u8,
u7_: u8,
u8__: u8,
u9_: u8,
} // pub struct ProposalShortId
impl flatbuffers::SafeSliceAccess for ProposalShortId {}
impl<'a> flatbuffers::Follow<'a> for ProposalShortId {
type Inner = &'a ProposalShortId;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
<&'a ProposalShortId>::follow(buf, loc)
}
}
impl<'a> flatbuffers::Follow<'a> for &'a ProposalShortId {
type Inner = &'a ProposalShortId;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
flatbuffers::follow_cast_ref::<ProposalShortId>(buf, loc)
}
}
impl<'b> flatbuffers::Push for ProposalShortId {
type Output = ProposalShortId;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const ProposalShortId as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
}
impl<'b> flatbuffers::Push for &'b ProposalShortId {
type Output = ProposalShortId;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const ProposalShortId as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
}
impl ProposalShortId {
pub fn new<'a>(_u0: u8, _u1: u8, _u2: u8, _u3: u8, _u4: u8, _u5: u8, _u6: u8, _u7: u8, _u8_: u8, _u9: u8) -> Self {
ProposalShortId {
u0_: _u0.to_little_endian(),
u1_: _u1.to_little_endian(),
u2_: _u2.to_little_endian(),
u3_: _u3.to_little_endian(),
u4_: _u4.to_little_endian(),
u5_: _u5.to_little_endian(),
u6_: _u6.to_little_endian(),
u7_: _u7.to_little_endian(),
u8__: _u8_.to_little_endian(),
u9_: _u9.to_little_endian(),
}
}
pub fn u0<'a>(&'a self) -> u8 {
self.u0_.from_little_endian()
}
pub fn u1<'a>(&'a self) -> u8 {
self.u1_.from_little_endian()
}
pub fn u2<'a>(&'a self) -> u8 {
self.u2_.from_little_endian()
}
pub fn u3<'a>(&'a self) -> u8 {
self.u3_.from_little_endian()
}
pub fn u4<'a>(&'a self) -> u8 {
self.u4_.from_little_endian()
}
pub fn u5<'a>(&'a self) -> u8 {
self.u5_.from_little_endian()
}
pub fn u6<'a>(&'a self) -> u8 {
self.u6_.from_little_endian()
}
pub fn u7<'a>(&'a self) -> u8 {
self.u7_.from_little_endian()
}
pub fn u8_<'a>(&'a self) -> u8 {
self.u8__.from_little_endian()
}
pub fn u9<'a>(&'a self) -> u8 {
self.u9_.from_little_endian()
}
}
// struct H256, aligned to 1
#[repr(C, align(1))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct H256 {
u0_: u8,
u1_: u8,
u2_: u8,
u3_: u8,
u4_: u8,
u5_: u8,
u6_: u8,
u7_: u8,
u8__: u8,
u9_: u8,
u10_: u8,
u11_: u8,
u12_: u8,
u13_: u8,
u14_: u8,
u15_: u8,
u16__: u8,
u17_: u8,
u18_: u8,
u19_: u8,
u20_: u8,
u21_: u8,
u22_: u8,
u23_: u8,
u24_: u8,
u25_: u8,
u26_: u8,
u27_: u8,
u28_: u8,
u29_: u8,
u30_: u8,
u31_: u8,
} // pub struct H256
impl flatbuffers::SafeSliceAccess for H256 {}
impl<'a> flatbuffers::Follow<'a> for H256 {
type Inner = &'a H256;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
<&'a H256>::follow(buf, loc)
}
}
impl<'a> flatbuffers::Follow<'a> for &'a H256 {
type Inner = &'a H256;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
flatbuffers::follow_cast_ref::<H256>(buf, loc)
}
}
impl<'b> flatbuffers::Push for H256 {
type Output = H256;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const H256 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
}
impl<'b> flatbuffers::Push for &'b H256 {
type Output = H256;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const H256 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
}
impl H256 {
pub fn new<'a>(_u0: u8, _u1: u8, _u2: u8, _u3: u8, _u4: u8, _u5: u8, _u6: u8, _u7: u8, _u8_: u8, _u9: u8, _u10: u8, _u11: u8, _u12: u8, _u13: u8, _u14: u8, _u15: u8, _u16_: u8, _u17: u8, _u18: u8, _u19: u8, _u20: u8, _u21: u8, _u22: u8, _u23: u8, _u24: u8, _u25: u8, _u26: u8, _u27: u8, _u28: u8, _u29: u8, _u30: u8, _u31: u8) -> Self {
H256 {
u0_: _u0.to_little_endian(),
u1_: _u1.to_little_endian(),
u2_: _u2.to_little_endian(),
u3_: _u3.to_little_endian(),
u4_: _u4.to_little_endian(),
u5_: _u5.to_little_endian(),
u6_: _u6.to_little_endian(),
u7_: _u7.to_little_endian(),
u8__: _u8_.to_little_endian(),
u9_: _u9.to_little_endian(),
u10_: _u10.to_little_endian(),
u11_: _u11.to_little_endian(),
u12_: _u12.to_little_endian(),
u13_: _u13.to_little_endian(),
u14_: _u14.to_little_endian(),
u15_: _u15.to_little_endian(),
u16__: _u16_.to_little_endian(),
u17_: _u17.to_little_endian(),
u18_: _u18.to_little_endian(),
u19_: _u19.to_little_endian(),
u20_: _u20.to_little_endian(),
u21_: _u21.to_little_endian(),
u22_: _u22.to_little_endian(),
u23_: _u23.to_little_endian(),
u24_: _u24.to_little_endian(),
u25_: _u25.to_little_endian(),
u26_: _u26.to_little_endian(),
u27_: _u27.to_little_endian(),
u28_: _u28.to_little_endian(),
u29_: _u29.to_little_endian(),
u30_: _u30.to_little_endian(),
u31_: _u31.to_little_endian(),
}
}
pub fn u0<'a>(&'a self) -> u8 {
self.u0_.from_little_endian()
}
pub fn u1<'a>(&'a self) -> u8 {
self.u1_.from_little_endian()
}
pub fn u2<'a>(&'a self) -> u8 {
self.u2_.from_little_endian()
}
pub fn u3<'a>(&'a self) -> u8 {
self.u3_.from_little_endian()
}
pub fn u4<'a>(&'a self) -> u8 {
self.u4_.from_little_endian()
}
pub fn u5<'a>(&'a self) -> u8 {
self.u5_.from_little_endian()
}
pub fn u6<'a>(&'a self) -> u8 {
self.u6_.from_little_endian()
}
pub fn u7<'a>(&'a self) -> u8 {
self.u7_.from_little_endian()
}
pub fn u8_<'a>(&'a self) -> u8 {
self.u8__.from_little_endian()
}
pub fn u9<'a>(&'a self) -> u8 {
self.u9_.from_little_endian()
}
pub fn u10<'a>(&'a self) -> u8 {
self.u10_.from_little_endian()
}
pub fn u11<'a>(&'a self) -> u8 {
self.u11_.from_little_endian()
}
pub fn u12<'a>(&'a self) -> u8 {
self.u12_.from_little_endian()
}
pub fn u13<'a>(&'a self) -> u8 {
self.u13_.from_little_endian()
}
pub fn u14<'a>(&'a self) -> u8 {
self.u14_.from_little_endian()
}
pub fn u15<'a>(&'a self) -> u8 {
self.u15_.from_little_endian()
}
pub fn u16_<'a>(&'a self) -> u8 {
self.u16__.from_little_endian()
}
pub fn u17<'a>(&'a self) -> u8 {
self.u17_.from_little_endian()
}
pub fn u18<'a>(&'a self) -> u8 {
self.u18_.from_little_endian()
}
pub fn u19<'a>(&'a self) -> u8 {
self.u19_.from_little_endian()
}
pub fn u20<'a>(&'a self) -> u8 {
self.u20_.from_little_endian()
}
pub fn u21<'a>(&'a self) -> u8 {
self.u21_.from_little_endian()
}
pub fn u22<'a>(&'a self) -> u8 {
self.u22_.from_little_endian()
}
pub fn u23<'a>(&'a self) -> u8 {
self.u23_.from_little_endian()
}
pub fn u24<'a>(&'a self) -> u8 {
self.u24_.from_little_endian()
}
pub fn u25<'a>(&'a self) -> u8 {
self.u25_.from_little_endian()
}
pub fn u26<'a>(&'a self) -> u8 {
self.u26_.from_little_endian()
}
pub fn u27<'a>(&'a self) -> u8 {
self.u27_.from_little_endian()
}
pub fn u28<'a>(&'a self) -> u8 {
self.u28_.from_little_endian()
}
pub fn u29<'a>(&'a self) -> u8 {
self.u29_.from_little_endian()
}
pub fn u30<'a>(&'a self) -> u8 {
self.u30_.from_little_endian()
}
pub fn u31<'a>(&'a self) -> u8 {
self.u31_.from_little_endian()
}
}
pub enum SyncMessageOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct SyncMessage<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for SyncMessage<'a> {
type Inner = SyncMessage<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table { buf: buf, loc: loc },
}
}
}
impl<'a> SyncMessage<'a> {
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
SyncMessage {
_tab: table,
}
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args SyncMessageArgs) -> flatbuffers::WIPOffset<SyncMessage<'bldr>> {
let mut builder = SyncMessageBuilder::new(_fbb);
if let Some(x) = args.payload { builder.add_payload(x); }
builder.add_payload_type(args.payload_type);
builder.finish()
}
pub const VT_PAYLOAD_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_PAYLOAD: flatbuffers::VOffsetT = 6;
#[inline]
pub fn payload_type(&self) -> SyncPayload {
self._tab.get::<SyncPayload>(SyncMessage::VT_PAYLOAD_TYPE, Some(SyncPayload::NONE)).unwrap()
}
#[inline]
pub fn payload(&self) -> Option<flatbuffers::Table<'a>> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(SyncMessage::VT_PAYLOAD, None)
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_get_headers(&'a self) -> Option<GetHeaders> {
if self.payload_type() == SyncPayload::GetHeaders {
self.payload().map(|u| GetHeaders::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_headers(&'a self) -> Option<Headers> {
if self.payload_type() == SyncPayload::Headers {
self.payload().map(|u| Headers::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_get_blocks(&'a self) -> Option<GetBlocks> {
if self.payload_type() == SyncPayload::GetBlocks {
self.payload().map(|u| GetBlocks::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_block(&'a self) -> Option<Block> {
if self.payload_type() == SyncPayload::Block {
self.payload().map(|u| Block::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_set_filter(&'a self) -> Option<SetFilter> {
if self.payload_type() == SyncPayload::SetFilter {
self.payload().map(|u| SetFilter::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_add_filter(&'a self) -> Option<AddFilter> {
if self.payload_type() == SyncPayload::AddFilter {
self.payload().map(|u| AddFilter::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_clear_filter(&'a self) -> Option<ClearFilter> {
if self.payload_type() == SyncPayload::ClearFilter {
self.payload().map(|u| ClearFilter::init_from_table(u))
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn payload_as_filtered_block(&'a self) -> Option<FilteredBlock> {
if self.payload_type() == SyncPayload::FilteredBlock {
self.payload().map(|u| FilteredBlock::init_from_table(u))
} else {
None
}
}
}
pub struct SyncMessageArgs {
pub payload_type: SyncPayload,
pub payload: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for SyncMessageArgs {
#[inline]
fn default() -> Self {
SyncMessageArgs {
payload_type: SyncPayload::NONE,
payload: None,
}
}
}
pub struct SyncMessageBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> SyncMessageBuilder<'a, 'b> {
#[inline]
pub fn add_payload_type(&mut self, payload_type: SyncPayload) {
self.fbb_.push_slot::<SyncPayload>(SyncMessage::VT_PAYLOAD_TYPE, payload_type, SyncPayload::NONE);
}
#[inline]
pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SyncMessage::VT_PAYLOAD, payload);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SyncMessageBuilder<'a, 'b> {
let start = _fbb.start_table();
SyncMessageBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<SyncMessage<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
pub enum BytesOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Bytes<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Bytes<'a> {
type Inner = Bytes<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table { buf: buf, loc: loc },
}
}
}
impl<'a> Bytes<'a> {
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Bytes {
_tab: table,
}
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args BytesArgs<'args>) -> flatbuffers::WIPOffset<Bytes<'bldr>> {
let mut builder = BytesBuilder::new(_fbb);
if let Some(x) = args.seq { builder.add_seq(x); }
builder.finish()
}
pub const VT_SEQ: flatbuffers::VOffsetT = 4;
#[inline]
pub fn seq(&self) -> Option<&'a [u8]> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Bytes::VT_SEQ, None).map(|v| v.safe_slice())
}
}
pub struct BytesArgs<'a> {
pub seq: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
}
impl<'a> Default for BytesArgs<'a> {
#[inline]
fn default() -> Self {
BytesArgs {
seq: None,
}
}
}
pub struct BytesBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> BytesBuilder<'a, 'b> {
#[inline]
pub fn add_seq(&mut self, seq: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Bytes::VT_SEQ, seq);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> BytesBuilder<'a, 'b> {
let start = _fbb.start_table();
BytesBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Bytes<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
pub enum GetHeadersOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct GetHeaders<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for GetHeaders<'a> {
type Inner = GetHeaders<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table { buf: buf, loc: loc },
}
}
}
impl<'a> GetHeaders<'a> {
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
GetHeaders {
_tab: table,
}
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args GetHeadersArgs<'args>) -> flatbuffers::WIPOffset<GetHeaders<'bldr>> {
let mut builder = GetHeadersBuilder::new(_fbb);
if let Some(x) = args.hash_stop { builder.add_hash_stop(x); }
if let Some(x) = args.block_locator_hashes { builder.add_block_locator_hashes(x); }
builder.add_version(args.version);
builder.finish()
}
pub const VT_VERSION: flatbuffers::VOffsetT = 4;
pub const VT_BLOCK_LOCATOR_HASHES: flatbuffers::VOffsetT = 6;
pub const VT_HASH_STOP: flatbuffers::VOffsetT = 8;
#[inline]
pub fn version(&self) -> u32 {
self._tab.get::<u32>(GetHeaders::VT_VERSION, Some(0)).unwrap()
}
#[inline]
pub fn block_locator_hashes(&self) -> Option<&'a [H256]> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<H256>>>(GetHeaders::VT_BLOCK_LOCATOR_HASHES, None).map(|v| v.safe_slice() )
}
#[inline]
pub fn hash_stop(&self) -> Option<&'a H256> {
self._tab.get::<H256>(GetHeaders::VT_HASH_STOP, None)
}
}
pub struct GetHeadersArgs<'a> {
pub version: u32,
pub block_locator_hashes: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , H256>>>,
pub hash_stop: Option<&'a H256>,
}
impl<'a> Default for GetHeadersArgs<'a> {
#[inline]
fn default() -> Self {
GetHeadersArgs {
version: 0,
block_locator_hashes: None,
hash_stop: None,
}
}
}
pub struct GetHeadersBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> GetHeadersBuilder<'a, 'b> {
#[inline]
pub fn add_version(&mut self, version: u32) {
self.fbb_.push_slot::<u32>(GetHeaders::VT_VERSION, version, 0);
}
#[inline]
pub fn add_block_locator_hashes(&mut self, block_locator_hashes: flatbuffers::WIPOffset<flatbuffers::Vector<'b , H256>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(GetHeaders::VT_BLOCK_LOCATOR_HASHES, block_locator_hashes);
}
#[inline]
pub fn add_hash_stop(&mut self, hash_stop: &'b H256) {
self.fbb_.push_slot_always::<&H256>(GetHeaders::VT_HASH_STOP, hash_stop);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetHeadersBuilder<'a, 'b> {
let start = _fbb.start_table();
GetHeadersBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<GetHeaders<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
pub enum GetBlocksOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct GetBlocks<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for GetBlocks<'a> {
type Inner = GetBlocks<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table { buf: buf, loc: loc },
}
}
}
impl<'a> GetBlocks<'a> {
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
GetBlocks {
_tab: table,
}
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args GetBlocksArgs<'args>) -> flatbuffers::WIPOffset<GetBlocks<'bldr>> {
let mut builder = GetBlocksBuilder::new(_fbb);
if let Some(x) = args.block_hashes { builder.add_block_hashes(x); }
builder.finish()
}
pub const VT_BLOCK_HASHES: flatbuffers::VOffsetT = 4;
#[inline]
pub fn block_hashes(&self) -> Option<&'a [H256]> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<H256>>>(GetBlocks::VT_BLOCK_HASHES, None).map(|v| v.safe_slice() )
}
}
pub struct GetBlocksArgs<'a> {
pub block_hashes: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , H256>>>,
}
impl<'a> Default for GetBlocksArgs<'a> {
#[inline]
fn default() -> Self {
GetBlocksArgs {
block_hashes: None,
}
}
}
pub struct GetBlocksBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> GetBlocksBuilder<'a, 'b> {
#[inline]
pub fn add_block_hashes(&mut self, block_hashes: flatbuffers::WIPOffset<flatbuffers::Vector<'b , H256>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(GetBlocks::VT_BLOCK_HASHES, block_hashes);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetBlocksBuilder<'a, 'b> {
let start = _fbb.start_table();
GetBlocksBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<GetBlocks<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
pub enum HeadersOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Headers<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Headers<'a> {
type Inner = Headers<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table { buf: buf, loc: loc },
}
}
}
impl<'a> Headers<'a> {
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Headers {
_tab: table,
}
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args HeadersArgs<'args>) -> flatbuffers::WIPOffset<Headers<'bldr>> {
let mut builder = HeadersBuilder::new(_fbb);
if let Some(x) = args.headers { builder.add_headers(x); }
builder.finish()
}
pub const VT_HEADERS: flatbuffers::VOffsetT = 4;
#[inline]
pub fn headers(&self) -> Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Header<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Header<'a>>>>>(Headers::VT_HEADERS, None)
}
}
pub struct HeadersArgs<'a> {
pub headers: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Header<'a >>>>>,
}
impl<'a> Default for HeadersArgs<'a> {
#[inline]
fn default() -> Self {
HeadersArgs {
headers: None,
}
}
}
pub struct HeadersBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> HeadersBuilder<'a, 'b> {
#[inline]
pub fn add_headers(&mut self, headers: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Header<'b >>>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Headers::VT_HEADERS, headers);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> HeadersBuilder<'a, 'b> {
let start = _fbb.start_table();
HeadersBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Headers<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
pub enum HeaderOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Header<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Header<'a> {
type Inner = Header<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {