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
|
// automatically generated by the FlatBuffers compiler, do not modify
#![allow(unused_imports, dead_code)]
use std::mem;
use std::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::EndianScalar;
#[allow(unused_imports, dead_code)]
pub mod optional_scalars {
use std::mem;
use std::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::EndianScalar;
#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0;
#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_OPTIONAL_BYTE: i8 = 2;
#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_OPTIONAL_BYTE: [OptionalByte; 3] = [
OptionalByte::None,
OptionalByte::One,
OptionalByte::Two,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct OptionalByte(pub i8);
#[allow(non_upper_case_globals)]
impl OptionalByte {
pub const None: Self = Self(0);
pub const One: Self = Self(1);
pub const Two: Self = Self(2);
pub const ENUM_MIN: i8 = 0;
pub const ENUM_MAX: i8 = 2;
pub const ENUM_VALUES: &'static [Self] = &[
Self::None,
Self::One,
Self::Two,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::None => Some("None"),
Self::One => Some("One"),
Self::Two => Some("Two"),
_ => None,
}
}
}
impl std::fmt::Debug for OptionalByte {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for OptionalByte {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self(flatbuffers::read_scalar_at::<i8>(buf, loc))
}
}
impl flatbuffers::Push for OptionalByte {
type Output = OptionalByte;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
flatbuffers::emplace_scalar::<i8>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for OptionalByte {
#[inline]
fn to_little_endian(self) -> Self {
Self(i8::to_le(self.0))
}
#[inline]
fn from_little_endian(self) -> Self {
Self(i8::from_le(self.0))
}
}
pub enum ScalarStuffOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ScalarStuff<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for ScalarStuff<'a> {
type Inner = ScalarStuff<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> ScalarStuff<'a> {
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
ScalarStuff {
_tab: table,
}
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args ScalarStuffArgs) -> flatbuffers::WIPOffset<ScalarStuff<'bldr>> {
let mut builder = ScalarStuffBuilder::new(_fbb);
builder.add_default_f64(args.default_f64);
if let Some(x) = args.maybe_f64 { builder.add_maybe_f64(x); }
builder.add_just_f64(args.just_f64);
builder.add_default_u64(args.default_u64);
if let Some(x) = args.maybe_u64 { builder.add_maybe_u64(x); }
builder.add_just_u64(args.just_u64);
builder.add_default_i64(args.default_i64);
if let Some(x) = args.maybe_i64 { builder.add_maybe_i64(x); }
builder.add_just_i64(args.just_i64);
builder.add_default_f32(args.default_f32);
if let Some(x) = args.maybe_f32 { builder.add_maybe_f32(x); }
builder.add_just_f32(args.just_f32);
builder.add_default_u32(args.default_u32);
if let Some(x) = args.maybe_u32 { builder.add_maybe_u32(x); }
builder.add_just_u32(args.just_u32);
builder.add_default_i32(args.default_i32);
if let Some(x) = args.maybe_i32 { builder.add_maybe_i32(x); }
builder.add_just_i32(args.just_i32);
builder.add_default_u16(args.default_u16);
if let Some(x) = args.maybe_u16 { builder.add_maybe_u16(x); }
builder.add_just_u16(args.just_u16);
builder.add_default_i16(args.default_i16);
if let Some(x) = args.maybe_i16 { builder.add_maybe_i16(x); }
builder.add_just_i16(args.just_i16);
builder.add_default_enum(args.default_enum);
if let Some(x) = args.maybe_enum { builder.add_maybe_enum(x); }
builder.add_just_enum(args.just_enum);
builder.add_default_bool(args.default_bool);
if let Some(x) = args.maybe_bool { builder.add_maybe_bool(x); }
builder.add_just_bool(args.just_bool);
builder.add_default_u8(args.default_u8);
if let Some(x) = args.maybe_u8 { builder.add_maybe_u8(x); }
builder.add_just_u8(args.just_u8);
builder.add_default_i8(args.default_i8);
if let Some(x) = args.maybe_i8 { builder.add_maybe_i8(x); }
builder.add_just_i8(args.just_i8);
builder.finish()
}
pub const VT_JUST_I8: flatbuffers::VOffsetT = 4;
pub const VT_MAYBE_I8: flatbuffers::VOffsetT = 6;
pub const VT_DEFAULT_I8: flatbuffers::VOffsetT = 8;
pub const VT_JUST_U8: flatbuffers::VOffsetT = 10;
pub const VT_MAYBE_U8: flatbuffers::VOffsetT = 12;
pub const VT_DEFAULT_U8: flatbuffers::VOffsetT = 14;
pub const VT_JUST_I16: flatbuffers::VOffsetT = 16;
pub const VT_MAYBE_I16: flatbuffers::VOffsetT = 18;
pub const VT_DEFAULT_I16: flatbuffers::VOffsetT = 20;
pub const VT_JUST_U16: flatbuffers::VOffsetT = 22;
pub const VT_MAYBE_U16: flatbuffers::VOffsetT = 24;
pub const VT_DEFAULT_U16: flatbuffers::VOffsetT = 26;
pub const VT_JUST_I32: flatbuffers::VOffsetT = 28;
pub const VT_MAYBE_I32: flatbuffers::VOffsetT = 30;
pub const VT_DEFAULT_I32: flatbuffers::VOffsetT = 32;
pub const VT_JUST_U32: flatbuffers::VOffsetT = 34;
pub const VT_MAYBE_U32: flatbuffers::VOffsetT = 36;
pub const VT_DEFAULT_U32: flatbuffers::VOffsetT = 38;
pub const VT_JUST_I64: flatbuffers::VOffsetT = 40;
pub const VT_MAYBE_I64: flatbuffers::VOffsetT = 42;
pub const VT_DEFAULT_I64: flatbuffers::VOffsetT = 44;
pub const VT_JUST_U64: flatbuffers::VOffsetT = 46;
pub const VT_MAYBE_U64: flatbuffers::VOffsetT = 48;
pub const VT_DEFAULT_U64: flatbuffers::VOffsetT = 50;
pub const VT_JUST_F32: flatbuffers::VOffsetT = 52;
pub const VT_MAYBE_F32: flatbuffers::VOffsetT = 54;
pub const VT_DEFAULT_F32: flatbuffers::VOffsetT = 56;
pub const VT_JUST_F64: flatbuffers::VOffsetT = 58;
pub const VT_MAYBE_F64: flatbuffers::VOffsetT = 60;
pub const VT_DEFAULT_F64: flatbuffers::VOffsetT = 62;
pub const VT_JUST_BOOL: flatbuffers::VOffsetT = 64;
pub const VT_MAYBE_BOOL: flatbuffers::VOffsetT = 66;
pub const VT_DEFAULT_BOOL: flatbuffers::VOffsetT = 68;
pub const VT_JUST_ENUM: flatbuffers::VOffsetT = 70;
pub const VT_MAYBE_ENUM: flatbuffers::VOffsetT = 72;
pub const VT_DEFAULT_ENUM: flatbuffers::VOffsetT = 74;
#[inline]
pub fn just_i8(&self) -> i8 {
self._tab.get::<i8>(ScalarStuff::VT_JUST_I8, Some(0)).unwrap()
}
#[inline]
pub fn maybe_i8(&self) -> Option<i8> {
self._tab.get::<i8>(ScalarStuff::VT_MAYBE_I8, None)
}
#[inline]
pub fn default_i8(&self) -> i8 {
self._tab.get::<i8>(ScalarStuff::VT_DEFAULT_I8, Some(42)).unwrap()
}
#[inline]
pub fn just_u8(&self) -> u8 {
self._tab.get::<u8>(ScalarStuff::VT_JUST_U8, Some(0)).unwrap()
}
#[inline]
pub fn maybe_u8(&self) -> Option<u8> {
self._tab.get::<u8>(ScalarStuff::VT_MAYBE_U8, None)
}
#[inline]
pub fn default_u8(&self) -> u8 {
self._tab.get::<u8>(ScalarStuff::VT_DEFAULT_U8, Some(42)).unwrap()
}
#[inline]
pub fn just_i16(&self) -> i16 {
self._tab.get::<i16>(ScalarStuff::VT_JUST_I16, Some(0)).unwrap()
}
#[inline]
pub fn maybe_i16(&self) -> Option<i16> {
self._tab.get::<i16>(ScalarStuff::VT_MAYBE_I16, None)
}
#[inline]
pub fn default_i16(&self) -> i16 {
self._tab.get::<i16>(ScalarStuff::VT_DEFAULT_I16, Some(42)).unwrap()
}
#[inline]
pub fn just_u16(&self) -> u16 {
self._tab.get::<u16>(ScalarStuff::VT_JUST_U16, Some(0)).unwrap()
}
#[inline]
pub fn maybe_u16(&self) -> Option<u16> {
self._tab.get::<u16>(ScalarStuff::VT_MAYBE_U16, None)
}
#[inline]
pub fn default_u16(&self) -> u16 {
self._tab.get::<u16>(ScalarStuff::VT_DEFAULT_U16, Some(42)).unwrap()
}
#[inline]
pub fn just_i32(&self) -> i32 {
self._tab.get::<i32>(ScalarStuff::VT_JUST_I32, Some(0)).unwrap()
}
#[inline]
pub fn maybe_i32(&self) -> Option<i32> {
self._tab.get::<i32>(ScalarStuff::VT_MAYBE_I32, None)
}
#[inline]
pub fn default_i32(&self) -> i32 {
self._tab.get::<i32>(ScalarStuff::VT_DEFAULT_I32, Some(42)).unwrap()
}
#[inline]
pub fn just_u32(&self) -> u32 {
self._tab.get::<u32>(ScalarStuff::VT_JUST_U32, Some(0)).unwrap()
}
#[inline]
pub fn maybe_u32(&self) -> Option<u32> {
self._tab.get::<u32>(ScalarStuff::VT_MAYBE_U32, None)
}
#[inline]
pub fn default_u32(&self) -> u32 {
self._tab.get::<u32>(ScalarStuff::VT_DEFAULT_U32, Some(42)).unwrap()
}
#[inline]
pub fn just_i64(&self) -> i64 {
self._tab.get::<i64>(ScalarStuff::VT_JUST_I64, Some(0)).unwrap()
}
#[inline]
pub fn maybe_i64(&self) -> Option<i64> {
self._tab.get::<i64>(ScalarStuff::VT_MAYBE_I64, None)
}
#[inline]
pub fn default_i64(&self) -> i64 {
self._tab.get::<i64>(ScalarStuff::VT_DEFAULT_I64, Some(42)).unwrap()
}
#[inline]
pub fn just_u64(&self) -> u64 {
self._tab.get::<u64>(ScalarStuff::VT_JUST_U64, Some(0)).unwrap()
}
#[inline]
pub fn maybe_u64(&self) -> Option<u64> {
self._tab.get::<u64>(ScalarStuff::VT_MAYBE_U64, None)
}
#[inline]
pub fn default_u64(&self) -> u64 {
self._tab.get::<u64>(ScalarStuff::VT_DEFAULT_U64, Some(42)).unwrap()
}
#[inline]
pub fn just_f32(&self) -> f32 {
self._tab.get::<f32>(ScalarStuff::VT_JUST_F32, Some(0.0)).unwrap()
}
#[inline]
pub fn maybe_f32(&self) -> Option<f32> {
self._tab.get::<f32>(ScalarStuff::VT_MAYBE_F32, None)
}
#[inline]
pub fn default_f32(&self) -> f32 {
self._tab.get::<f32>(ScalarStuff::VT_DEFAULT_F32, Some(42.0)).unwrap()
}
#[inline]
pub fn just_f64(&self) -> f64 {
self._tab.get::<f64>(ScalarStuff::VT_JUST_F64, Some(0.0)).unwrap()
}
#[inline]
pub fn maybe_f64(&self) -> Option<f64> {
self._tab.get::<f64>(ScalarStuff::VT_MAYBE_F64, None)
}
#[inline]
pub fn default_f64(&self) -> f64 {
self._tab.get::<f64>(ScalarStuff::VT_DEFAULT_F64, Some(42.0)).unwrap()
}
#[inline]
pub fn just_bool(&self) -> bool {
self._tab.get::<bool>(ScalarStuff::VT_JUST_BOOL, Some(false)).unwrap()
}
#[inline]
pub fn maybe_bool(&self) -> Option<bool> {
self._tab.get::<bool>(ScalarStuff::VT_MAYBE_BOOL, None)
}
#[inline]
pub fn default_bool(&self) -> bool {
self._tab.get::<bool>(ScalarStuff::VT_DEFAULT_BOOL, Some(true)).unwrap()
}
#[inline]
pub fn just_enum(&self) -> OptionalByte {
self._tab.get::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, Some(OptionalByte::None)).unwrap()
}
#[inline]
pub fn maybe_enum(&self) -> Option<OptionalByte> {
self._tab.get::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, None)
}
#[inline]
pub fn default_enum(&self) -> OptionalByte {
self._tab.get::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, Some(OptionalByte::One)).unwrap()
}
}
pub struct ScalarStuffArgs {
pub just_i8: i8,
pub maybe_i8: Option<i8>,
pub default_i8: i8,
pub just_u8: u8,
pub maybe_u8: Option<u8>,
pub default_u8: u8,
pub just_i16: i16,
pub maybe_i16: Option<i16>,
pub default_i16: i16,
pub just_u16: u16,
pub maybe_u16: Option<u16>,
pub default_u16: u16,
pub just_i32: i32,
pub maybe_i32: Option<i32>,
pub default_i32: i32,
pub just_u32: u32,
pub maybe_u32: Option<u32>,
pub default_u32: u32,
pub just_i64: i64,
pub maybe_i64: Option<i64>,
pub default_i64: i64,
pub just_u64: u64,
pub maybe_u64: Option<u64>,
pub default_u64: u64,
pub just_f32: f32,
pub maybe_f32: Option<f32>,
pub default_f32: f32,
pub just_f64: f64,
pub maybe_f64: Option<f64>,
pub default_f64: f64,
pub just_bool: bool,
pub maybe_bool: Option<bool>,
pub default_bool: bool,
pub just_enum: OptionalByte,
pub maybe_enum: Option<OptionalByte>,
pub default_enum: OptionalByte,
}
impl<'a> Default for ScalarStuffArgs {
#[inline]
fn default() -> Self {
ScalarStuffArgs {
just_i8: 0,
maybe_i8: None,
default_i8: 42,
just_u8: 0,
maybe_u8: None,
default_u8: 42,
just_i16: 0,
maybe_i16: None,
default_i16: 42,
just_u16: 0,
maybe_u16: None,
default_u16: 42,
just_i32: 0,
maybe_i32: None,
default_i32: 42,
just_u32: 0,
maybe_u32: None,
default_u32: 42,
just_i64: 0,
maybe_i64: None,
default_i64: 42,
just_u64: 0,
maybe_u64: None,
default_u64: 42,
just_f32: 0.0,
maybe_f32: None,
default_f32: 42.0,
just_f64: 0.0,
maybe_f64: None,
default_f64: 42.0,
just_bool: false,
maybe_bool: None,
default_bool: true,
just_enum: OptionalByte::None,
maybe_enum: None,
default_enum: OptionalByte::One,
}
}
}
pub struct ScalarStuffBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> ScalarStuffBuilder<'a, 'b> {
#[inline]
pub fn add_just_i8(&mut self, just_i8: i8) {
self.fbb_.push_slot::<i8>(ScalarStuff::VT_JUST_I8, just_i8, 0);
}
#[inline]
pub fn add_maybe_i8(&mut self, maybe_i8: i8) {
self.fbb_.push_slot_always::<i8>(ScalarStuff::VT_MAYBE_I8, maybe_i8);
}
#[inline]
pub fn add_default_i8(&mut self, default_i8: i8) {
self.fbb_.push_slot::<i8>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42);
}
#[inline]
pub fn add_just_u8(&mut self, just_u8: u8) {
self.fbb_.push_slot::<u8>(ScalarStuff::VT_JUST_U8, just_u8, 0);
}
#[inline]
pub fn add_maybe_u8(&mut self, maybe_u8: u8) {
self.fbb_.push_slot_always::<u8>(ScalarStuff::VT_MAYBE_U8, maybe_u8);
}
#[inline]
pub fn add_default_u8(&mut self, default_u8: u8) {
self.fbb_.push_slot::<u8>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42);
}
#[inline]
pub fn add_just_i16(&mut self, just_i16: i16) {
self.fbb_.push_slot::<i16>(ScalarStuff::VT_JUST_I16, just_i16, 0);
}
#[inline]
pub fn add_maybe_i16(&mut self, maybe_i16: i16) {
self.fbb_.push_slot_always::<i16>(ScalarStuff::VT_MAYBE_I16, maybe_i16);
}
#[inline]
pub fn add_default_i16(&mut self, default_i16: i16) {
self.fbb_.push_slot::<i16>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42);
}
#[inline]
pub fn add_just_u16(&mut self, just_u16: u16) {
self.fbb_.push_slot::<u16>(ScalarStuff::VT_JUST_U16, just_u16, 0);
}
#[inline]
pub fn add_maybe_u16(&mut self, maybe_u16: u16) {
self.fbb_.push_slot_always::<u16>(ScalarStuff::VT_MAYBE_U16, maybe_u16);
}
#[inline]
pub fn add_default_u16(&mut self, default_u16: u16) {
self.fbb_.push_slot::<u16>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42);
}
#[inline]
pub fn add_just_i32(&mut self, just_i32: i32) {
self.fbb_.push_slot::<i32>(ScalarStuff::VT_JUST_I32, just_i32, 0);
}
#[inline]
pub fn add_maybe_i32(&mut self, maybe_i32: i32) {
self.fbb_.push_slot_always::<i32>(ScalarStuff::VT_MAYBE_I32, maybe_i32);
}
#[inline]
pub fn add_default_i32(&mut self, default_i32: i32) {
self.fbb_.push_slot::<i32>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42);
}
#[inline]
pub fn add_just_u32(&mut self, just_u32: u32) {
self.fbb_.push_slot::<u32>(ScalarStuff::VT_JUST_U32, just_u32, 0);
}
#[inline]
pub fn add_maybe_u32(&mut self, maybe_u32: u32) {
self.fbb_.push_slot_always::<u32>(ScalarStuff::VT_MAYBE_U32, maybe_u32);
}
#[inline]
pub fn add_default_u32(&mut self, default_u32: u32) {
self.fbb_.push_slot::<u32>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42);
}
#[inline]
pub fn add_just_i64(&mut self, just_i64: i64) {
self.fbb_.push_slot::<i64>(ScalarStuff::VT_JUST_I64, just_i64, 0);
}
#[inline]
pub fn add_maybe_i64(&mut self, maybe_i64: i64) {
self.fbb_.push_slot_always::<i64>(ScalarStuff::VT_MAYBE_I64, maybe_i64);
}
#[inline]
pub fn add_default_i64(&mut self, default_i64: i64) {
self.fbb_.push_slot::<i64>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42);
}
#[inline]
pub fn add_just_u64(&mut self, just_u64: u64) {
self.fbb_.push_slot::<u64>(ScalarStuff::VT_JUST_U64, just_u64, 0);
}
#[inline]
pub fn add_maybe_u64(&mut self, maybe_u64: u64) {
self.fbb_.push_slot_always::<u64>(ScalarStuff::VT_MAYBE_U64, maybe_u64);
}
#[inline]
pub fn add_default_u64(&mut self, default_u64: u64) {
self.fbb_.push_slot::<u64>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42);
}
#[inline]
pub fn add_just_f32(&mut self, just_f32: f32) {
self.fbb_.push_slot::<f32>(ScalarStuff::VT_JUST_F32, just_f32, 0.0);
}
#[inline]
pub fn add_maybe_f32(&mut self, maybe_f32: f32) {
self.fbb_.push_slot_always::<f32>(ScalarStuff::VT_MAYBE_F32, maybe_f32);
}
#[inline]
pub fn add_default_f32(&mut self, default_f32: f32) {
self.fbb_.push_slot::<f32>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0);
}
#[inline]
pub fn add_just_f64(&mut self, just_f64: f64) {
self.fbb_.push_slot::<f64>(ScalarStuff::VT_JUST_F64, just_f64, 0.0);
}
#[inline]
pub fn add_maybe_f64(&mut self, maybe_f64: f64) {
self.fbb_.push_slot_always::<f64>(ScalarStuff::VT_MAYBE_F64, maybe_f64);
}
#[inline]
pub fn add_default_f64(&mut self, default_f64: f64) {
self.fbb_.push_slot::<f64>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0);
}
#[inline]
pub fn add_just_bool(&mut self, just_bool: bool) {
self.fbb_.push_slot::<bool>(ScalarStuff::VT_JUST_BOOL, just_bool, false);
}
#[inline]
pub fn add_maybe_bool(&mut self, maybe_bool: bool) {
self.fbb_.push_slot_always::<bool>(ScalarStuff::VT_MAYBE_BOOL, maybe_bool);
}
#[inline]
pub fn add_default_bool(&mut self, default_bool: bool) {
self.fbb_.push_slot::<bool>(ScalarStuff::VT_DEFAULT_BOOL, default_bool, true);
}
#[inline]
pub fn add_just_enum(&mut self, just_enum: OptionalByte) {
self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, just_enum, OptionalByte::None);
}
#[inline]
pub fn add_maybe_enum(&mut self, maybe_enum: OptionalByte) {
self.fbb_.push_slot_always::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, maybe_enum);
}
#[inline]
pub fn add_default_enum(&mut self, default_enum: OptionalByte) {
self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, default_enum, OptionalByte::One);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ScalarStuffBuilder<'a, 'b> {
let start = _fbb.start_table();
ScalarStuffBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<ScalarStuff<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl std::fmt::Debug for ScalarStuff<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut ds = f.debug_struct("ScalarStuff");
ds.field("just_i8", &self.just_i8());
ds.field("maybe_i8", &self.maybe_i8());
ds.field("default_i8", &self.default_i8());
ds.field("just_u8", &self.just_u8());
ds.field("maybe_u8", &self.maybe_u8());
ds.field("default_u8", &self.default_u8());
ds.field("just_i16", &self.just_i16());
ds.field("maybe_i16", &self.maybe_i16());
ds.field("default_i16", &self.default_i16());
ds.field("just_u16", &self.just_u16());
ds.field("maybe_u16", &self.maybe_u16());
ds.field("default_u16", &self.default_u16());
ds.field("just_i32", &self.just_i32());
ds.field("maybe_i32", &self.maybe_i32());
ds.field("default_i32", &self.default_i32());
ds.field("just_u32", &self.just_u32());
ds.field("maybe_u32", &self.maybe_u32());
ds.field("default_u32", &self.default_u32());
ds.field("just_i64", &self.just_i64());
ds.field("maybe_i64", &self.maybe_i64());
ds.field("default_i64", &self.default_i64());
ds.field("just_u64", &self.just_u64());
ds.field("maybe_u64", &self.maybe_u64());
ds.field("default_u64", &self.default_u64());
ds.field("just_f32", &self.just_f32());
ds.field("maybe_f32", &self.maybe_f32());
ds.field("default_f32", &self.default_f32());
ds.field("just_f64", &self.just_f64());
ds.field("maybe_f64", &self.maybe_f64());
ds.field("default_f64", &self.default_f64());
ds.field("just_bool", &self.just_bool());
ds.field("maybe_bool", &self.maybe_bool());
ds.field("default_bool", &self.default_bool());
ds.field("just_enum", &self.just_enum());
ds.field("maybe_enum", &self.maybe_enum());
ds.field("default_enum", &self.default_enum());
ds.finish()
}
}
#[inline]
pub fn get_root_as_scalar_stuff<'a>(buf: &'a [u8]) -> ScalarStuff<'a> {
flatbuffers::get_root::<ScalarStuff<'a>>(buf)
}
#[inline]
pub fn get_size_prefixed_root_as_scalar_stuff<'a>(buf: &'a [u8]) -> ScalarStuff<'a> {
flatbuffers::get_size_prefixed_root::<ScalarStuff<'a>>(buf)
}
pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL";
#[inline]
pub fn scalar_stuff_buffer_has_identifier(buf: &[u8]) -> bool {
flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, false)
}
#[inline]
pub fn scalar_stuff_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, true)
}
pub const SCALAR_STUFF_EXTENSION: &str = "mon";
#[inline]
pub fn finish_scalar_stuff_buffer<'a, 'b>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
root: flatbuffers::WIPOffset<ScalarStuff<'a>>) {
fbb.finish(root, Some(SCALAR_STUFF_IDENTIFIER));
}
#[inline]
pub fn finish_size_prefixed_scalar_stuff_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<ScalarStuff<'a>>) {
fbb.finish_size_prefixed(root, Some(SCALAR_STUFF_IDENTIFIER));
}
} // pub mod optional_scalars
|