blob: 59bbf378eb253e34aaca0036ed01c9a4e7cdcceb [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2
3
4
5use std::mem;
6use std::cmp::Ordering;
7
8extern crate flatbuffers;
9use self::flatbuffers::EndianScalar;
10
11#[allow(unused_imports, dead_code)]
12pub mod my_game {
13
14 use std::mem;
15 use std::cmp::Ordering;
16
17 extern crate flatbuffers;
18 use self::flatbuffers::EndianScalar;
19
20pub enum InParentNamespaceOffset {}
21#[derive(Copy, Clone, Debug, PartialEq)]
22
23pub struct InParentNamespace<'a> {
24 pub _tab: flatbuffers::Table<'a>,
25}
26
27impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> {
28 type Inner = InParentNamespace<'a>;
29 #[inline]
30 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
31 Self {
32 _tab: flatbuffers::Table { buf: buf, loc: loc },
33 }
34 }
35}
36
37impl<'a> InParentNamespace<'a> {
38 #[inline]
39 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
40 InParentNamespace {
41 _tab: table,
42 }
43 }
44 #[allow(unused_mut)]
45 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
46 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
47 _args: &'args InParentNamespaceArgs) -> flatbuffers::WIPOffset<InParentNamespace<'bldr>> {
48 let mut builder = InParentNamespaceBuilder::new(_fbb);
49 builder.finish()
50 }
51
52}
53
54pub struct InParentNamespaceArgs {
55}
56impl<'a> Default for InParentNamespaceArgs {
57 #[inline]
58 fn default() -> Self {
59 InParentNamespaceArgs {
60 }
61 }
62}
63pub struct InParentNamespaceBuilder<'a: 'b, 'b> {
64 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
65 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
66}
67impl<'a: 'b, 'b> InParentNamespaceBuilder<'a, 'b> {
68 #[inline]
69 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> InParentNamespaceBuilder<'a, 'b> {
70 let start = _fbb.start_table();
71 InParentNamespaceBuilder {
72 fbb_: _fbb,
73 start_: start,
74 }
75 }
76 #[inline]
77 pub fn finish(self) -> flatbuffers::WIPOffset<InParentNamespace<'a>> {
78 let o = self.fbb_.end_table(self.start_);
79 flatbuffers::WIPOffset::new(o.value())
80 }
81}
82
83#[allow(unused_imports, dead_code)]
84pub mod example_2 {
85
86 use std::mem;
87 use std::cmp::Ordering;
88
89 extern crate flatbuffers;
90 use self::flatbuffers::EndianScalar;
91
92pub enum MonsterOffset {}
93#[derive(Copy, Clone, Debug, PartialEq)]
94
95pub struct Monster<'a> {
96 pub _tab: flatbuffers::Table<'a>,
97}
98
99impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
100 type Inner = Monster<'a>;
101 #[inline]
102 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
103 Self {
104 _tab: flatbuffers::Table { buf: buf, loc: loc },
105 }
106 }
107}
108
109impl<'a> Monster<'a> {
110 #[inline]
111 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
112 Monster {
113 _tab: table,
114 }
115 }
116 #[allow(unused_mut)]
117 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
118 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
119 _args: &'args MonsterArgs) -> flatbuffers::WIPOffset<Monster<'bldr>> {
120 let mut builder = MonsterBuilder::new(_fbb);
121 builder.finish()
122 }
123
124}
125
126pub struct MonsterArgs {
127}
128impl<'a> Default for MonsterArgs {
129 #[inline]
130 fn default() -> Self {
131 MonsterArgs {
132 }
133 }
134}
135pub struct MonsterBuilder<'a: 'b, 'b> {
136 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
137 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
138}
139impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
140 #[inline]
141 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
142 let start = _fbb.start_table();
143 MonsterBuilder {
144 fbb_: _fbb,
145 start_: start,
146 }
147 }
148 #[inline]
149 pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
150 let o = self.fbb_.end_table(self.start_);
151 flatbuffers::WIPOffset::new(o.value())
152 }
153}
154
155} // pub mod Example2
156
157#[allow(unused_imports, dead_code)]
158pub mod example {
159
160 use std::mem;
161 use std::cmp::Ordering;
162
163 extern crate flatbuffers;
164 use self::flatbuffers::EndianScalar;
165
166/// Composite components of Monster color.
167#[allow(non_camel_case_types)]
168#[repr(u8)]
169#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
170pub enum Color {
171 Red = 1,
172 /// \brief color Green
173 /// Green is bit_flag with value (1u << 1)
174 Green = 2,
175 /// \brief color Blue (1u << 3)
176 Blue = 8,
177
178}
179
180const ENUM_MIN_COLOR: u8 = 1;
181const ENUM_MAX_COLOR: u8 = 8;
182
183impl<'a> flatbuffers::Follow<'a> for Color {
184 type Inner = Self;
185 #[inline]
186 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
187 flatbuffers::read_scalar_at::<Self>(buf, loc)
188 }
189}
190
191impl flatbuffers::EndianScalar for Color {
192 #[inline]
193 fn to_little_endian(self) -> Self {
194 let n = u8::to_le(self as u8);
195 let p = &n as *const u8 as *const Color;
196 unsafe { *p }
197 }
198 #[inline]
199 fn from_little_endian(self) -> Self {
200 let n = u8::from_le(self as u8);
201 let p = &n as *const u8 as *const Color;
202 unsafe { *p }
203 }
204}
205
206impl flatbuffers::Push for Color {
207 type Output = Color;
208 #[inline]
209 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
210 flatbuffers::emplace_scalar::<Color>(dst, *self);
211 }
212}
213
214#[allow(non_camel_case_types)]
215const ENUM_VALUES_COLOR:[Color; 3] = [
216 Color::Red,
217 Color::Green,
218 Color::Blue
219];
220
221#[allow(non_camel_case_types)]
222const ENUM_NAMES_COLOR:[&'static str; 8] = [
223 "Red",
224 "Green",
225 "",
226 "",
227 "",
228 "",
229 "",
230 "Blue"
231];
232
233pub fn enum_name_color(e: Color) -> &'static str {
234 let index = e as u8 - Color::Red as u8;
235 ENUM_NAMES_COLOR[index as usize]
236}
237
238#[allow(non_camel_case_types)]
239#[repr(u8)]
240#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
241pub enum Any {
242 NONE = 0,
243 Monster = 1,
244 TestSimpleTableWithEnum = 2,
245 MyGame_Example2_Monster = 3,
246
247}
248
249const ENUM_MIN_ANY: u8 = 0;
250const ENUM_MAX_ANY: u8 = 3;
251
252impl<'a> flatbuffers::Follow<'a> for Any {
253 type Inner = Self;
254 #[inline]
255 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
256 flatbuffers::read_scalar_at::<Self>(buf, loc)
257 }
258}
259
260impl flatbuffers::EndianScalar for Any {
261 #[inline]
262 fn to_little_endian(self) -> Self {
263 let n = u8::to_le(self as u8);
264 let p = &n as *const u8 as *const Any;
265 unsafe { *p }
266 }
267 #[inline]
268 fn from_little_endian(self) -> Self {
269 let n = u8::from_le(self as u8);
270 let p = &n as *const u8 as *const Any;
271 unsafe { *p }
272 }
273}
274
275impl flatbuffers::Push for Any {
276 type Output = Any;
277 #[inline]
278 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
279 flatbuffers::emplace_scalar::<Any>(dst, *self);
280 }
281}
282
283#[allow(non_camel_case_types)]
284const ENUM_VALUES_ANY:[Any; 4] = [
285 Any::NONE,
286 Any::Monster,
287 Any::TestSimpleTableWithEnum,
288 Any::MyGame_Example2_Monster
289];
290
291#[allow(non_camel_case_types)]
292const ENUM_NAMES_ANY:[&'static str; 4] = [
293 "NONE",
294 "Monster",
295 "TestSimpleTableWithEnum",
296 "MyGame_Example2_Monster"
297];
298
299pub fn enum_name_any(e: Any) -> &'static str {
300 let index = e as u8;
301 ENUM_NAMES_ANY[index as usize]
302}
303
304pub struct AnyUnionTableOffset {}
305#[allow(non_camel_case_types)]
306#[repr(u8)]
307#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
308pub enum AnyUniqueAliases {
309 NONE = 0,
310 M = 1,
311 TS = 2,
312 M2 = 3,
313
314}
315
316const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
317const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
318
319impl<'a> flatbuffers::Follow<'a> for AnyUniqueAliases {
320 type Inner = Self;
321 #[inline]
322 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
323 flatbuffers::read_scalar_at::<Self>(buf, loc)
324 }
325}
326
327impl flatbuffers::EndianScalar for AnyUniqueAliases {
328 #[inline]
329 fn to_little_endian(self) -> Self {
330 let n = u8::to_le(self as u8);
331 let p = &n as *const u8 as *const AnyUniqueAliases;
332 unsafe { *p }
333 }
334 #[inline]
335 fn from_little_endian(self) -> Self {
336 let n = u8::from_le(self as u8);
337 let p = &n as *const u8 as *const AnyUniqueAliases;
338 unsafe { *p }
339 }
340}
341
342impl flatbuffers::Push for AnyUniqueAliases {
343 type Output = AnyUniqueAliases;
344 #[inline]
345 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
346 flatbuffers::emplace_scalar::<AnyUniqueAliases>(dst, *self);
347 }
348}
349
350#[allow(non_camel_case_types)]
351const ENUM_VALUES_ANY_UNIQUE_ALIASES:[AnyUniqueAliases; 4] = [
352 AnyUniqueAliases::NONE,
353 AnyUniqueAliases::M,
354 AnyUniqueAliases::TS,
355 AnyUniqueAliases::M2
356];
357
358#[allow(non_camel_case_types)]
359const ENUM_NAMES_ANY_UNIQUE_ALIASES:[&'static str; 4] = [
360 "NONE",
361 "M",
362 "TS",
363 "M2"
364];
365
366pub fn enum_name_any_unique_aliases(e: AnyUniqueAliases) -> &'static str {
367 let index = e as u8;
368 ENUM_NAMES_ANY_UNIQUE_ALIASES[index as usize]
369}
370
371pub struct AnyUniqueAliasesUnionTableOffset {}
372#[allow(non_camel_case_types)]
373#[repr(u8)]
374#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
375pub enum AnyAmbiguousAliases {
376 NONE = 0,
377 M1 = 1,
378 M2 = 2,
379 M3 = 3,
380
381}
382
383const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
384const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
385
386impl<'a> flatbuffers::Follow<'a> for AnyAmbiguousAliases {
387 type Inner = Self;
388 #[inline]
389 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
390 flatbuffers::read_scalar_at::<Self>(buf, loc)
391 }
392}
393
394impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
395 #[inline]
396 fn to_little_endian(self) -> Self {
397 let n = u8::to_le(self as u8);
398 let p = &n as *const u8 as *const AnyAmbiguousAliases;
399 unsafe { *p }
400 }
401 #[inline]
402 fn from_little_endian(self) -> Self {
403 let n = u8::from_le(self as u8);
404 let p = &n as *const u8 as *const AnyAmbiguousAliases;
405 unsafe { *p }
406 }
407}
408
409impl flatbuffers::Push for AnyAmbiguousAliases {
410 type Output = AnyAmbiguousAliases;
411 #[inline]
412 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
413 flatbuffers::emplace_scalar::<AnyAmbiguousAliases>(dst, *self);
414 }
415}
416
417#[allow(non_camel_case_types)]
418const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES:[AnyAmbiguousAliases; 4] = [
419 AnyAmbiguousAliases::NONE,
420 AnyAmbiguousAliases::M1,
421 AnyAmbiguousAliases::M2,
422 AnyAmbiguousAliases::M3
423];
424
425#[allow(non_camel_case_types)]
426const ENUM_NAMES_ANY_AMBIGUOUS_ALIASES:[&'static str; 4] = [
427 "NONE",
428 "M1",
429 "M2",
430 "M3"
431];
432
433pub fn enum_name_any_ambiguous_aliases(e: AnyAmbiguousAliases) -> &'static str {
434 let index = e as u8;
435 ENUM_NAMES_ANY_AMBIGUOUS_ALIASES[index as usize]
436}
437
438pub struct AnyAmbiguousAliasesUnionTableOffset {}
439// struct Test, aligned to 2
440#[repr(C, align(2))]
441#[derive(Clone, Copy, Debug, PartialEq)]
442pub struct Test {
443 a_: i16,
444 b_: i8,
445 padding0__: u8,
446} // pub struct Test
447impl flatbuffers::SafeSliceAccess for Test {}
448impl<'a> flatbuffers::Follow<'a> for Test {
449 type Inner = &'a Test;
450 #[inline]
451 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
452 <&'a Test>::follow(buf, loc)
453 }
454}
455impl<'a> flatbuffers::Follow<'a> for &'a Test {
456 type Inner = &'a Test;
457 #[inline]
458 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
459 flatbuffers::follow_cast_ref::<Test>(buf, loc)
460 }
461}
462impl<'b> flatbuffers::Push for Test {
463 type Output = Test;
464 #[inline]
465 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
466 let src = unsafe {
467 ::std::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
468 };
469 dst.copy_from_slice(src);
470 }
471}
472impl<'b> flatbuffers::Push for &'b Test {
473 type Output = Test;
474
475 #[inline]
476 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
477 let src = unsafe {
478 ::std::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
479 };
480 dst.copy_from_slice(src);
481 }
482}
483
484
485impl Test {
486 pub fn new<'a>(_a: i16, _b: i8) -> Self {
487 Test {
488 a_: _a.to_little_endian(),
489 b_: _b.to_little_endian(),
490
491 padding0__: 0,
492 }
493 }
494 pub fn a<'a>(&'a self) -> i16 {
495 self.a_.from_little_endian()
496 }
497 pub fn b<'a>(&'a self) -> i8 {
498 self.b_.from_little_endian()
499 }
500}
501
502// struct Vec3, aligned to 8
503#[repr(C, align(8))]
504#[derive(Clone, Copy, Debug, PartialEq)]
505pub struct Vec3 {
506 x_: f32,
507 y_: f32,
508 z_: f32,
509 padding0__: u32,
510 test1_: f64,
511 test2_: Color,
512 padding1__: u8,
513 test3_: Test,
514 padding2__: u16,
515} // pub struct Vec3
516impl flatbuffers::SafeSliceAccess for Vec3 {}
517impl<'a> flatbuffers::Follow<'a> for Vec3 {
518 type Inner = &'a Vec3;
519 #[inline]
520 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
521 <&'a Vec3>::follow(buf, loc)
522 }
523}
524impl<'a> flatbuffers::Follow<'a> for &'a Vec3 {
525 type Inner = &'a Vec3;
526 #[inline]
527 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
528 flatbuffers::follow_cast_ref::<Vec3>(buf, loc)
529 }
530}
531impl<'b> flatbuffers::Push for Vec3 {
532 type Output = Vec3;
533 #[inline]
534 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
535 let src = unsafe {
536 ::std::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
537 };
538 dst.copy_from_slice(src);
539 }
540}
541impl<'b> flatbuffers::Push for &'b Vec3 {
542 type Output = Vec3;
543
544 #[inline]
545 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
546 let src = unsafe {
547 ::std::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
548 };
549 dst.copy_from_slice(src);
550 }
551}
552
553
554impl Vec3 {
555 pub fn new<'a>(_x: f32, _y: f32, _z: f32, _test1: f64, _test2: Color, _test3: &'a Test) -> Self {
556 Vec3 {
557 x_: _x.to_little_endian(),
558 y_: _y.to_little_endian(),
559 z_: _z.to_little_endian(),
560 test1_: _test1.to_little_endian(),
561 test2_: _test2.to_little_endian(),
562 test3_: *_test3,
563
564 padding0__: 0,
565 padding1__: 0,
566 padding2__: 0,
567 }
568 }
569 pub fn x<'a>(&'a self) -> f32 {
570 self.x_.from_little_endian()
571 }
572 pub fn y<'a>(&'a self) -> f32 {
573 self.y_.from_little_endian()
574 }
575 pub fn z<'a>(&'a self) -> f32 {
576 self.z_.from_little_endian()
577 }
578 pub fn test1<'a>(&'a self) -> f64 {
579 self.test1_.from_little_endian()
580 }
581 pub fn test2<'a>(&'a self) -> Color {
582 self.test2_.from_little_endian()
583 }
584 pub fn test3<'a>(&'a self) -> &'a Test {
585 &self.test3_
586 }
587}
588
589// struct Ability, aligned to 4
590#[repr(C, align(4))]
591#[derive(Clone, Copy, Debug, PartialEq)]
592pub struct Ability {
593 id_: u32,
594 distance_: u32,
595} // pub struct Ability
596impl flatbuffers::SafeSliceAccess for Ability {}
597impl<'a> flatbuffers::Follow<'a> for Ability {
598 type Inner = &'a Ability;
599 #[inline]
600 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
601 <&'a Ability>::follow(buf, loc)
602 }
603}
604impl<'a> flatbuffers::Follow<'a> for &'a Ability {
605 type Inner = &'a Ability;
606 #[inline]
607 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
608 flatbuffers::follow_cast_ref::<Ability>(buf, loc)
609 }
610}
611impl<'b> flatbuffers::Push for Ability {
612 type Output = Ability;
613 #[inline]
614 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
615 let src = unsafe {
616 ::std::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
617 };
618 dst.copy_from_slice(src);
619 }
620}
621impl<'b> flatbuffers::Push for &'b Ability {
622 type Output = Ability;
623
624 #[inline]
625 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
626 let src = unsafe {
627 ::std::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
628 };
629 dst.copy_from_slice(src);
630 }
631}
632
633
634impl Ability {
635 pub fn new<'a>(_id: u32, _distance: u32) -> Self {
636 Ability {
637 id_: _id.to_little_endian(),
638 distance_: _distance.to_little_endian(),
639
640 }
641 }
642 pub fn id<'a>(&'a self) -> u32 {
643 self.id_.from_little_endian()
644 }
645 #[inline]
646 pub fn key_compare_less_than(&self, o: &Ability) -> bool {
647 self.id() < o.id()
648 }
649
650 #[inline]
651 pub fn key_compare_with_value(&self, val: u32) -> ::std::cmp::Ordering {
652 let key = self.id();
653 key.cmp(&val)
654 }
655 pub fn distance<'a>(&'a self) -> u32 {
656 self.distance_.from_little_endian()
657 }
658}
659
660pub enum TestSimpleTableWithEnumOffset {}
661#[derive(Copy, Clone, Debug, PartialEq)]
662
663pub struct TestSimpleTableWithEnum<'a> {
664 pub _tab: flatbuffers::Table<'a>,
665}
666
667impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
668 type Inner = TestSimpleTableWithEnum<'a>;
669 #[inline]
670 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
671 Self {
672 _tab: flatbuffers::Table { buf: buf, loc: loc },
673 }
674 }
675}
676
677impl<'a> TestSimpleTableWithEnum<'a> {
678 #[inline]
679 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
680 TestSimpleTableWithEnum {
681 _tab: table,
682 }
683 }
684 #[allow(unused_mut)]
685 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
686 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
687 args: &'args TestSimpleTableWithEnumArgs) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> {
688 let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb);
689 builder.add_color(args.color);
690 builder.finish()
691 }
692
693 pub const VT_COLOR: flatbuffers::VOffsetT = 4;
694
695 #[inline]
696 pub fn color(&self) -> Color {
697 self._tab.get::<Color>(TestSimpleTableWithEnum::VT_COLOR, Some(Color::Green)).unwrap()
698 }
699}
700
701pub struct TestSimpleTableWithEnumArgs {
702 pub color: Color,
703}
704impl<'a> Default for TestSimpleTableWithEnumArgs {
705 #[inline]
706 fn default() -> Self {
707 TestSimpleTableWithEnumArgs {
708 color: Color::Green,
709 }
710 }
711}
712pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b> {
713 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
714 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
715}
716impl<'a: 'b, 'b> TestSimpleTableWithEnumBuilder<'a, 'b> {
717 #[inline]
718 pub fn add_color(&mut self, color: Color) {
719 self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
720 }
721 #[inline]
722 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TestSimpleTableWithEnumBuilder<'a, 'b> {
723 let start = _fbb.start_table();
724 TestSimpleTableWithEnumBuilder {
725 fbb_: _fbb,
726 start_: start,
727 }
728 }
729 #[inline]
730 pub fn finish(self) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
731 let o = self.fbb_.end_table(self.start_);
732 flatbuffers::WIPOffset::new(o.value())
733 }
734}
735
736pub enum StatOffset {}
737#[derive(Copy, Clone, Debug, PartialEq)]
738
739pub struct Stat<'a> {
740 pub _tab: flatbuffers::Table<'a>,
741}
742
743impl<'a> flatbuffers::Follow<'a> for Stat<'a> {
744 type Inner = Stat<'a>;
745 #[inline]
746 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
747 Self {
748 _tab: flatbuffers::Table { buf: buf, loc: loc },
749 }
750 }
751}
752
753impl<'a> Stat<'a> {
754 #[inline]
755 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
756 Stat {
757 _tab: table,
758 }
759 }
760 #[allow(unused_mut)]
761 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
762 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
763 args: &'args StatArgs<'args>) -> flatbuffers::WIPOffset<Stat<'bldr>> {
764 let mut builder = StatBuilder::new(_fbb);
765 builder.add_val(args.val);
766 if let Some(x) = args.id { builder.add_id(x); }
767 builder.add_count(args.count);
768 builder.finish()
769 }
770
771 pub const VT_ID: flatbuffers::VOffsetT = 4;
772 pub const VT_VAL: flatbuffers::VOffsetT = 6;
773 pub const VT_COUNT: flatbuffers::VOffsetT = 8;
774
775 #[inline]
776 pub fn id(&self) -> Option<&'a str> {
777 self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)
778 }
779 #[inline]
780 pub fn val(&self) -> i64 {
781 self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()
782 }
783 #[inline]
784 pub fn count(&self) -> u16 {
785 self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()
786 }
787}
788
789pub struct StatArgs<'a> {
790 pub id: Option<flatbuffers::WIPOffset<&'a str>>,
791 pub val: i64,
792 pub count: u16,
793}
794impl<'a> Default for StatArgs<'a> {
795 #[inline]
796 fn default() -> Self {
797 StatArgs {
798 id: None,
799 val: 0,
800 count: 0,
801 }
802 }
803}
804pub struct StatBuilder<'a: 'b, 'b> {
805 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
806 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
807}
808impl<'a: 'b, 'b> StatBuilder<'a, 'b> {
809 #[inline]
810 pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) {
811 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
812 }
813 #[inline]
814 pub fn add_val(&mut self, val: i64) {
815 self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0);
816 }
817 #[inline]
818 pub fn add_count(&mut self, count: u16) {
819 self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
820 }
821 #[inline]
822 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> StatBuilder<'a, 'b> {
823 let start = _fbb.start_table();
824 StatBuilder {
825 fbb_: _fbb,
826 start_: start,
827 }
828 }
829 #[inline]
830 pub fn finish(self) -> flatbuffers::WIPOffset<Stat<'a>> {
831 let o = self.fbb_.end_table(self.start_);
832 flatbuffers::WIPOffset::new(o.value())
833 }
834}
835
836pub enum ReferrableOffset {}
837#[derive(Copy, Clone, Debug, PartialEq)]
838
839pub struct Referrable<'a> {
840 pub _tab: flatbuffers::Table<'a>,
841}
842
843impl<'a> flatbuffers::Follow<'a> for Referrable<'a> {
844 type Inner = Referrable<'a>;
845 #[inline]
846 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
847 Self {
848 _tab: flatbuffers::Table { buf: buf, loc: loc },
849 }
850 }
851}
852
853impl<'a> Referrable<'a> {
854 #[inline]
855 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
856 Referrable {
857 _tab: table,
858 }
859 }
860 #[allow(unused_mut)]
861 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
862 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
863 args: &'args ReferrableArgs) -> flatbuffers::WIPOffset<Referrable<'bldr>> {
864 let mut builder = ReferrableBuilder::new(_fbb);
865 builder.add_id(args.id);
866 builder.finish()
867 }
868
869 pub const VT_ID: flatbuffers::VOffsetT = 4;
870
871 #[inline]
872 pub fn id(&self) -> u64 {
873 self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()
874 }
875 #[inline]
876 pub fn key_compare_less_than(&self, o: &Referrable) -> bool {
877 self.id() < o.id()
878 }
879
880 #[inline]
881 pub fn key_compare_with_value(&self, val: u64) -> ::std::cmp::Ordering {
882 let key = self.id();
883 key.cmp(&val)
884 }
885}
886
887pub struct ReferrableArgs {
888 pub id: u64,
889}
890impl<'a> Default for ReferrableArgs {
891 #[inline]
892 fn default() -> Self {
893 ReferrableArgs {
894 id: 0,
895 }
896 }
897}
898pub struct ReferrableBuilder<'a: 'b, 'b> {
899 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
900 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
901}
902impl<'a: 'b, 'b> ReferrableBuilder<'a, 'b> {
903 #[inline]
904 pub fn add_id(&mut self, id: u64) {
905 self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
906 }
907 #[inline]
908 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ReferrableBuilder<'a, 'b> {
909 let start = _fbb.start_table();
910 ReferrableBuilder {
911 fbb_: _fbb,
912 start_: start,
913 }
914 }
915 #[inline]
916 pub fn finish(self) -> flatbuffers::WIPOffset<Referrable<'a>> {
917 let o = self.fbb_.end_table(self.start_);
918 flatbuffers::WIPOffset::new(o.value())
919 }
920}
921
922pub enum MonsterOffset {}
923#[derive(Copy, Clone, Debug, PartialEq)]
924
925/// an example documentation comment: monster object
926pub struct Monster<'a> {
927 pub _tab: flatbuffers::Table<'a>,
928}
929
930impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
931 type Inner = Monster<'a>;
932 #[inline]
933 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
934 Self {
935 _tab: flatbuffers::Table { buf: buf, loc: loc },
936 }
937 }
938}
939
940impl<'a> Monster<'a> {
941 #[inline]
942 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
943 Monster {
944 _tab: table,
945 }
946 }
947 #[allow(unused_mut)]
948 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
949 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
950 args: &'args MonsterArgs<'args>) -> flatbuffers::WIPOffset<Monster<'bldr>> {
951 let mut builder = MonsterBuilder::new(_fbb);
952 builder.add_non_owning_reference(args.non_owning_reference);
953 builder.add_co_owning_reference(args.co_owning_reference);
954 builder.add_single_weak_reference(args.single_weak_reference);
955 builder.add_testhashu64_fnv1a(args.testhashu64_fnv1a);
956 builder.add_testhashs64_fnv1a(args.testhashs64_fnv1a);
957 builder.add_testhashu64_fnv1(args.testhashu64_fnv1);
958 builder.add_testhashs64_fnv1(args.testhashs64_fnv1);
959 if let Some(x) = args.vector_of_enums { builder.add_vector_of_enums(x); }
960 if let Some(x) = args.any_ambiguous { builder.add_any_ambiguous(x); }
961 if let Some(x) = args.any_unique { builder.add_any_unique(x); }
962 if let Some(x) = args.vector_of_non_owning_references { builder.add_vector_of_non_owning_references(x); }
963 if let Some(x) = args.vector_of_co_owning_references { builder.add_vector_of_co_owning_references(x); }
964 if let Some(x) = args.vector_of_strong_referrables { builder.add_vector_of_strong_referrables(x); }
965 if let Some(x) = args.vector_of_weak_references { builder.add_vector_of_weak_references(x); }
966 if let Some(x) = args.vector_of_referrables { builder.add_vector_of_referrables(x); }
967 if let Some(x) = args.parent_namespace_test { builder.add_parent_namespace_test(x); }
968 if let Some(x) = args.vector_of_doubles { builder.add_vector_of_doubles(x); }
969 if let Some(x) = args.vector_of_longs { builder.add_vector_of_longs(x); }
970 if let Some(x) = args.test5 { builder.add_test5(x); }
971 if let Some(x) = args.flex { builder.add_flex(x); }
972 if let Some(x) = args.testarrayofsortedstruct { builder.add_testarrayofsortedstruct(x); }
973 if let Some(x) = args.testarrayofstring2 { builder.add_testarrayofstring2(x); }
974 builder.add_testf3(args.testf3);
975 builder.add_testf2(args.testf2);
976 builder.add_testf(args.testf);
977 if let Some(x) = args.testarrayofbools { builder.add_testarrayofbools(x); }
978 builder.add_testhashu32_fnv1a(args.testhashu32_fnv1a);
979 builder.add_testhashs32_fnv1a(args.testhashs32_fnv1a);
980 builder.add_testhashu32_fnv1(args.testhashu32_fnv1);
981 builder.add_testhashs32_fnv1(args.testhashs32_fnv1);
982 if let Some(x) = args.testempty { builder.add_testempty(x); }
983 if let Some(x) = args.testnestedflatbuffer { builder.add_testnestedflatbuffer(x); }
984 if let Some(x) = args.enemy { builder.add_enemy(x); }
985 if let Some(x) = args.testarrayoftables { builder.add_testarrayoftables(x); }
986 if let Some(x) = args.testarrayofstring { builder.add_testarrayofstring(x); }
987 if let Some(x) = args.test4 { builder.add_test4(x); }
988 if let Some(x) = args.test { builder.add_test(x); }
989 if let Some(x) = args.inventory { builder.add_inventory(x); }
990 if let Some(x) = args.name { builder.add_name(x); }
991 if let Some(x) = args.pos { builder.add_pos(x); }
992 builder.add_hp(args.hp);
993 builder.add_mana(args.mana);
994 builder.add_any_ambiguous_type(args.any_ambiguous_type);
995 builder.add_any_unique_type(args.any_unique_type);
996 builder.add_testbool(args.testbool);
997 builder.add_test_type(args.test_type);
998 builder.add_color(args.color);
999 builder.finish()
1000 }
1001
1002 pub const VT_POS: flatbuffers::VOffsetT = 4;
1003 pub const VT_MANA: flatbuffers::VOffsetT = 6;
1004 pub const VT_HP: flatbuffers::VOffsetT = 8;
1005 pub const VT_NAME: flatbuffers::VOffsetT = 10;
1006 pub const VT_INVENTORY: flatbuffers::VOffsetT = 14;
1007 pub const VT_COLOR: flatbuffers::VOffsetT = 16;
1008 pub const VT_TEST_TYPE: flatbuffers::VOffsetT = 18;
1009 pub const VT_TEST: flatbuffers::VOffsetT = 20;
1010 pub const VT_TEST4: flatbuffers::VOffsetT = 22;
1011 pub const VT_TESTARRAYOFSTRING: flatbuffers::VOffsetT = 24;
1012 pub const VT_TESTARRAYOFTABLES: flatbuffers::VOffsetT = 26;
1013 pub const VT_ENEMY: flatbuffers::VOffsetT = 28;
1014 pub const VT_TESTNESTEDFLATBUFFER: flatbuffers::VOffsetT = 30;
1015 pub const VT_TESTEMPTY: flatbuffers::VOffsetT = 32;
1016 pub const VT_TESTBOOL: flatbuffers::VOffsetT = 34;
1017 pub const VT_TESTHASHS32_FNV1: flatbuffers::VOffsetT = 36;
1018 pub const VT_TESTHASHU32_FNV1: flatbuffers::VOffsetT = 38;
1019 pub const VT_TESTHASHS64_FNV1: flatbuffers::VOffsetT = 40;
1020 pub const VT_TESTHASHU64_FNV1: flatbuffers::VOffsetT = 42;
1021 pub const VT_TESTHASHS32_FNV1A: flatbuffers::VOffsetT = 44;
1022 pub const VT_TESTHASHU32_FNV1A: flatbuffers::VOffsetT = 46;
1023 pub const VT_TESTHASHS64_FNV1A: flatbuffers::VOffsetT = 48;
1024 pub const VT_TESTHASHU64_FNV1A: flatbuffers::VOffsetT = 50;
1025 pub const VT_TESTARRAYOFBOOLS: flatbuffers::VOffsetT = 52;
1026 pub const VT_TESTF: flatbuffers::VOffsetT = 54;
1027 pub const VT_TESTF2: flatbuffers::VOffsetT = 56;
1028 pub const VT_TESTF3: flatbuffers::VOffsetT = 58;
1029 pub const VT_TESTARRAYOFSTRING2: flatbuffers::VOffsetT = 60;
1030 pub const VT_TESTARRAYOFSORTEDSTRUCT: flatbuffers::VOffsetT = 62;
1031 pub const VT_FLEX: flatbuffers::VOffsetT = 64;
1032 pub const VT_TEST5: flatbuffers::VOffsetT = 66;
1033 pub const VT_VECTOR_OF_LONGS: flatbuffers::VOffsetT = 68;
1034 pub const VT_VECTOR_OF_DOUBLES: flatbuffers::VOffsetT = 70;
1035 pub const VT_PARENT_NAMESPACE_TEST: flatbuffers::VOffsetT = 72;
1036 pub const VT_VECTOR_OF_REFERRABLES: flatbuffers::VOffsetT = 74;
1037 pub const VT_SINGLE_WEAK_REFERENCE: flatbuffers::VOffsetT = 76;
1038 pub const VT_VECTOR_OF_WEAK_REFERENCES: flatbuffers::VOffsetT = 78;
1039 pub const VT_VECTOR_OF_STRONG_REFERRABLES: flatbuffers::VOffsetT = 80;
1040 pub const VT_CO_OWNING_REFERENCE: flatbuffers::VOffsetT = 82;
1041 pub const VT_VECTOR_OF_CO_OWNING_REFERENCES: flatbuffers::VOffsetT = 84;
1042 pub const VT_NON_OWNING_REFERENCE: flatbuffers::VOffsetT = 86;
1043 pub const VT_VECTOR_OF_NON_OWNING_REFERENCES: flatbuffers::VOffsetT = 88;
1044 pub const VT_ANY_UNIQUE_TYPE: flatbuffers::VOffsetT = 90;
1045 pub const VT_ANY_UNIQUE: flatbuffers::VOffsetT = 92;
1046 pub const VT_ANY_AMBIGUOUS_TYPE: flatbuffers::VOffsetT = 94;
1047 pub const VT_ANY_AMBIGUOUS: flatbuffers::VOffsetT = 96;
1048 pub const VT_VECTOR_OF_ENUMS: flatbuffers::VOffsetT = 98;
1049
1050 #[inline]
1051 pub fn pos(&self) -> Option<&'a Vec3> {
1052 self._tab.get::<Vec3>(Monster::VT_POS, None)
1053 }
1054 #[inline]
1055 pub fn mana(&self) -> i16 {
1056 self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()
1057 }
1058 #[inline]
1059 pub fn hp(&self) -> i16 {
1060 self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()
1061 }
1062 #[inline]
1063 pub fn name(&self) -> &'a str {
1064 self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()
1065 }
1066 #[inline]
1067 pub fn key_compare_less_than(&self, o: &Monster) -> bool {
1068 self.name() < o.name()
1069 }
1070
1071 #[inline]
1072 pub fn key_compare_with_value(&self, val: & str) -> ::std::cmp::Ordering {
1073 let key = self.name();
1074 key.cmp(&val)
1075 }
1076 #[inline]
1077 pub fn inventory(&self) -> Option<&'a [u8]> {
1078 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None).map(|v| v.safe_slice())
1079 }
1080 #[inline]
1081 pub fn color(&self) -> Color {
1082 self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()
1083 }
1084 #[inline]
1085 pub fn test_type(&self) -> Any {
1086 self._tab.get::<Any>(Monster::VT_TEST_TYPE, Some(Any::NONE)).unwrap()
1087 }
1088 #[inline]
1089 pub fn test(&self) -> Option<flatbuffers::Table<'a>> {
1090 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_TEST, None)
1091 }
1092 #[inline]
1093 pub fn test4(&self) -> Option<&'a [Test]> {
1094 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<Test>>>(Monster::VT_TEST4, None).map(|v| v.safe_slice() )
1095 }
1096 #[inline]
1097 pub fn testarrayofstring(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
1098 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING, None)
1099 }
1100 /// an example documentation comment: this will end up in the generated code
1101 /// multiline too
1102 #[inline]
1103 pub fn testarrayoftables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>> {
1104 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Monster<'a>>>>>(Monster::VT_TESTARRAYOFTABLES, None)
1105 }
1106 #[inline]
1107 pub fn enemy(&self) -> Option<Monster<'a>> {
1108 self._tab.get::<flatbuffers::ForwardsUOffset<Monster<'a>>>(Monster::VT_ENEMY, None)
1109 }
1110 #[inline]
1111 pub fn testnestedflatbuffer(&self) -> Option<&'a [u8]> {
1112 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
1113 }
1114 pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
1115 match self.testnestedflatbuffer() {
1116 None => { None }
1117 Some(data) => {
1118 use self::flatbuffers::Follow;
1119 Some(<flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0))
1120 },
1121 }
1122 }
1123 #[inline]
1124 pub fn testempty(&self) -> Option<Stat<'a>> {
1125 self._tab.get::<flatbuffers::ForwardsUOffset<Stat<'a>>>(Monster::VT_TESTEMPTY, None)
1126 }
1127 #[inline]
1128 pub fn testbool(&self) -> bool {
1129 self._tab.get::<bool>(Monster::VT_TESTBOOL, Some(false)).unwrap()
1130 }
1131 #[inline]
1132 pub fn testhashs32_fnv1(&self) -> i32 {
1133 self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1, Some(0)).unwrap()
1134 }
1135 #[inline]
1136 pub fn testhashu32_fnv1(&self) -> u32 {
1137 self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1, Some(0)).unwrap()
1138 }
1139 #[inline]
1140 pub fn testhashs64_fnv1(&self) -> i64 {
1141 self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1, Some(0)).unwrap()
1142 }
1143 #[inline]
1144 pub fn testhashu64_fnv1(&self) -> u64 {
1145 self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1, Some(0)).unwrap()
1146 }
1147 #[inline]
1148 pub fn testhashs32_fnv1a(&self) -> i32 {
1149 self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1A, Some(0)).unwrap()
1150 }
1151 #[inline]
1152 pub fn testhashu32_fnv1a(&self) -> u32 {
1153 self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1A, Some(0)).unwrap()
1154 }
1155 #[inline]
1156 pub fn testhashs64_fnv1a(&self) -> i64 {
1157 self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1A, Some(0)).unwrap()
1158 }
1159 #[inline]
1160 pub fn testhashu64_fnv1a(&self) -> u64 {
1161 self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1A, Some(0)).unwrap()
1162 }
1163 #[inline]
1164 pub fn testarrayofbools(&self) -> Option<&'a [bool]> {
1165 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, bool>>>(Monster::VT_TESTARRAYOFBOOLS, None).map(|v| v.safe_slice())
1166 }
1167 #[inline]
1168 pub fn testf(&self) -> f32 {
1169 self._tab.get::<f32>(Monster::VT_TESTF, Some(3.14159)).unwrap()
1170 }
1171 #[inline]
1172 pub fn testf2(&self) -> f32 {
1173 self._tab.get::<f32>(Monster::VT_TESTF2, Some(3.0)).unwrap()
1174 }
1175 #[inline]
1176 pub fn testf3(&self) -> f32 {
1177 self._tab.get::<f32>(Monster::VT_TESTF3, Some(0.0)).unwrap()
1178 }
1179 #[inline]
1180 pub fn testarrayofstring2(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
1181 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING2, None)
1182 }
1183 #[inline]
1184 pub fn testarrayofsortedstruct(&self) -> Option<&'a [Ability]> {
1185 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<Ability>>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, None).map(|v| v.safe_slice() )
1186 }
1187 #[inline]
1188 pub fn flex(&self) -> Option<&'a [u8]> {
1189 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_FLEX, None).map(|v| v.safe_slice())
1190 }
1191 #[inline]
1192 pub fn test5(&self) -> Option<&'a [Test]> {
1193 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<Test>>>(Monster::VT_TEST5, None).map(|v| v.safe_slice() )
1194 }
1195 #[inline]
1196 pub fn vector_of_longs(&self) -> Option<flatbuffers::Vector<'a, i64>> {
1197 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i64>>>(Monster::VT_VECTOR_OF_LONGS, None)
1198 }
1199 #[inline]
1200 pub fn vector_of_doubles(&self) -> Option<flatbuffers::Vector<'a, f64>> {
1201 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Monster::VT_VECTOR_OF_DOUBLES, None)
1202 }
1203 #[inline]
1204 pub fn parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>> {
1205 self._tab.get::<flatbuffers::ForwardsUOffset<super::InParentNamespace<'a>>>(Monster::VT_PARENT_NAMESPACE_TEST, None)
1206 }
1207 #[inline]
1208 pub fn vector_of_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
1209 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Referrable<'a>>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None)
1210 }
1211 #[inline]
1212 pub fn single_weak_reference(&self) -> u64 {
1213 self._tab.get::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, Some(0)).unwrap()
1214 }
1215 #[inline]
1216 pub fn vector_of_weak_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
1217 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None)
1218 }
1219 #[inline]
1220 pub fn vector_of_strong_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
1221 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Referrable<'a>>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None)
1222 }
1223 #[inline]
1224 pub fn co_owning_reference(&self) -> u64 {
1225 self._tab.get::<u64>(Monster::VT_CO_OWNING_REFERENCE, Some(0)).unwrap()
1226 }
1227 #[inline]
1228 pub fn vector_of_co_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
1229 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, None)
1230 }
1231 #[inline]
1232 pub fn non_owning_reference(&self) -> u64 {
1233 self._tab.get::<u64>(Monster::VT_NON_OWNING_REFERENCE, Some(0)).unwrap()
1234 }
1235 #[inline]
1236 pub fn vector_of_non_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
1237 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)
1238 }
1239 #[inline]
1240 pub fn any_unique_type(&self) -> AnyUniqueAliases {
1241 self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()
1242 }
1243 #[inline]
1244 pub fn any_unique(&self) -> Option<flatbuffers::Table<'a>> {
1245 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)
1246 }
1247 #[inline]
1248 pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases {
1249 self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()
1250 }
1251 #[inline]
1252 pub fn any_ambiguous(&self) -> Option<flatbuffers::Table<'a>> {
1253 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)
1254 }
1255 #[inline]
1256 pub fn vector_of_enums(&self) -> Option<flatbuffers::Vector<'a, Color>> {
1257 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)
1258 }
1259 #[inline]
1260 #[allow(non_snake_case)]
1261 pub fn test_as_monster(&self) -> Option<Monster<'a>> {
1262 if self.test_type() == Any::Monster {
1263 self.test().map(|u| Monster::init_from_table(u))
1264 } else {
1265 None
1266 }
1267 }
1268
1269 #[inline]
1270 #[allow(non_snake_case)]
1271 pub fn test_as_test_simple_table_with_enum(&self) -> Option<TestSimpleTableWithEnum<'a>> {
1272 if self.test_type() == Any::TestSimpleTableWithEnum {
1273 self.test().map(|u| TestSimpleTableWithEnum::init_from_table(u))
1274 } else {
1275 None
1276 }
1277 }
1278
1279 #[inline]
1280 #[allow(non_snake_case)]
1281 pub fn test_as_my_game_example_2_monster(&self) -> Option<super::example_2::Monster<'a>> {
1282 if self.test_type() == Any::MyGame_Example2_Monster {
1283 self.test().map(|u| super::example_2::Monster::init_from_table(u))
1284 } else {
1285 None
1286 }
1287 }
1288
1289 #[inline]
1290 #[allow(non_snake_case)]
1291 pub fn any_unique_as_m(&self) -> Option<Monster<'a>> {
1292 if self.any_unique_type() == AnyUniqueAliases::M {
1293 self.any_unique().map(|u| Monster::init_from_table(u))
1294 } else {
1295 None
1296 }
1297 }
1298
1299 #[inline]
1300 #[allow(non_snake_case)]
1301 pub fn any_unique_as_ts(&self) -> Option<TestSimpleTableWithEnum<'a>> {
1302 if self.any_unique_type() == AnyUniqueAliases::TS {
1303 self.any_unique().map(|u| TestSimpleTableWithEnum::init_from_table(u))
1304 } else {
1305 None
1306 }
1307 }
1308
1309 #[inline]
1310 #[allow(non_snake_case)]
1311 pub fn any_unique_as_m2(&self) -> Option<super::example_2::Monster<'a>> {
1312 if self.any_unique_type() == AnyUniqueAliases::M2 {
1313 self.any_unique().map(|u| super::example_2::Monster::init_from_table(u))
1314 } else {
1315 None
1316 }
1317 }
1318
1319 #[inline]
1320 #[allow(non_snake_case)]
1321 pub fn any_ambiguous_as_m1(&self) -> Option<Monster<'a>> {
1322 if self.any_ambiguous_type() == AnyAmbiguousAliases::M1 {
1323 self.any_ambiguous().map(|u| Monster::init_from_table(u))
1324 } else {
1325 None
1326 }
1327 }
1328
1329 #[inline]
1330 #[allow(non_snake_case)]
1331 pub fn any_ambiguous_as_m2(&self) -> Option<Monster<'a>> {
1332 if self.any_ambiguous_type() == AnyAmbiguousAliases::M2 {
1333 self.any_ambiguous().map(|u| Monster::init_from_table(u))
1334 } else {
1335 None
1336 }
1337 }
1338
1339 #[inline]
1340 #[allow(non_snake_case)]
1341 pub fn any_ambiguous_as_m3(&self) -> Option<Monster<'a>> {
1342 if self.any_ambiguous_type() == AnyAmbiguousAliases::M3 {
1343 self.any_ambiguous().map(|u| Monster::init_from_table(u))
1344 } else {
1345 None
1346 }
1347 }
1348
1349}
1350
1351pub struct MonsterArgs<'a> {
1352 pub pos: Option<&'a Vec3>,
1353 pub mana: i16,
1354 pub hp: i16,
1355 pub name: Option<flatbuffers::WIPOffset<&'a str>>,
1356 pub inventory: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
1357 pub color: Color,
1358 pub test_type: Any,
1359 pub test: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
1360 pub test4: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Test>>>,
1361 pub testarrayofstring: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<&'a str>>>>,
1362 pub testarrayoftables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Monster<'a >>>>>,
1363 pub enemy: Option<flatbuffers::WIPOffset<Monster<'a >>>,
1364 pub testnestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
1365 pub testempty: Option<flatbuffers::WIPOffset<Stat<'a >>>,
1366 pub testbool: bool,
1367 pub testhashs32_fnv1: i32,
1368 pub testhashu32_fnv1: u32,
1369 pub testhashs64_fnv1: i64,
1370 pub testhashu64_fnv1: u64,
1371 pub testhashs32_fnv1a: i32,
1372 pub testhashu32_fnv1a: u32,
1373 pub testhashs64_fnv1a: i64,
1374 pub testhashu64_fnv1a: u64,
1375 pub testarrayofbools: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , bool>>>,
1376 pub testf: f32,
1377 pub testf2: f32,
1378 pub testf3: f32,
1379 pub testarrayofstring2: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<&'a str>>>>,
1380 pub testarrayofsortedstruct: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Ability>>>,
1381 pub flex: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
1382 pub test5: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Test>>>,
1383 pub vector_of_longs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , i64>>>,
1384 pub vector_of_doubles: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , f64>>>,
1385 pub parent_namespace_test: Option<flatbuffers::WIPOffset<super::InParentNamespace<'a >>>,
1386 pub vector_of_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Referrable<'a >>>>>,
1387 pub single_weak_reference: u64,
1388 pub vector_of_weak_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
1389 pub vector_of_strong_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Referrable<'a >>>>>,
1390 pub co_owning_reference: u64,
1391 pub vector_of_co_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
1392 pub non_owning_reference: u64,
1393 pub vector_of_non_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
1394 pub any_unique_type: AnyUniqueAliases,
1395 pub any_unique: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
1396 pub any_ambiguous_type: AnyAmbiguousAliases,
1397 pub any_ambiguous: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
1398 pub vector_of_enums: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Color>>>,
1399}
1400impl<'a> Default for MonsterArgs<'a> {
1401 #[inline]
1402 fn default() -> Self {
1403 MonsterArgs {
1404 pos: None,
1405 mana: 150,
1406 hp: 100,
1407 name: None, // required field
1408 inventory: None,
1409 color: Color::Blue,
1410 test_type: Any::NONE,
1411 test: None,
1412 test4: None,
1413 testarrayofstring: None,
1414 testarrayoftables: None,
1415 enemy: None,
1416 testnestedflatbuffer: None,
1417 testempty: None,
1418 testbool: false,
1419 testhashs32_fnv1: 0,
1420 testhashu32_fnv1: 0,
1421 testhashs64_fnv1: 0,
1422 testhashu64_fnv1: 0,
1423 testhashs32_fnv1a: 0,
1424 testhashu32_fnv1a: 0,
1425 testhashs64_fnv1a: 0,
1426 testhashu64_fnv1a: 0,
1427 testarrayofbools: None,
1428 testf: 3.14159,
1429 testf2: 3.0,
1430 testf3: 0.0,
1431 testarrayofstring2: None,
1432 testarrayofsortedstruct: None,
1433 flex: None,
1434 test5: None,
1435 vector_of_longs: None,
1436 vector_of_doubles: None,
1437 parent_namespace_test: None,
1438 vector_of_referrables: None,
1439 single_weak_reference: 0,
1440 vector_of_weak_references: None,
1441 vector_of_strong_referrables: None,
1442 co_owning_reference: 0,
1443 vector_of_co_owning_references: None,
1444 non_owning_reference: 0,
1445 vector_of_non_owning_references: None,
1446 any_unique_type: AnyUniqueAliases::NONE,
1447 any_unique: None,
1448 any_ambiguous_type: AnyAmbiguousAliases::NONE,
1449 any_ambiguous: None,
1450 vector_of_enums: None,
1451 }
1452 }
1453}
1454pub struct MonsterBuilder<'a: 'b, 'b> {
1455 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1456 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
1457}
1458impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
1459 #[inline]
1460 pub fn add_pos(&mut self, pos: &'b Vec3) {
1461 self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
1462 }
1463 #[inline]
1464 pub fn add_mana(&mut self, mana: i16) {
1465 self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150);
1466 }
1467 #[inline]
1468 pub fn add_hp(&mut self, hp: i16) {
1469 self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
1470 }
1471 #[inline]
1472 pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
1473 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
1474 }
1475 #[inline]
1476 pub fn add_inventory(&mut self, inventory: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
1477 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
1478 }
1479 #[inline]
1480 pub fn add_color(&mut self, color: Color) {
1481 self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
1482 }
1483 #[inline]
1484 pub fn add_test_type(&mut self, test_type: Any) {
1485 self.fbb_.push_slot::<Any>(Monster::VT_TEST_TYPE, test_type, Any::NONE);
1486 }
1487 #[inline]
1488 pub fn add_test(&mut self, test: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
1489 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST, test);
1490 }
1491 #[inline]
1492 pub fn add_test4(&mut self, test4: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>) {
1493 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST4, test4);
1494 }
1495 #[inline]
1496 pub fn add_testarrayofstring(&mut self, testarrayofstring: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
1497 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
1498 }
1499 #[inline]
1500 pub fn add_testarrayoftables(&mut self, testarrayoftables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Monster<'b >>>>) {
1501 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
1502 }
1503 #[inline]
1504 pub fn add_enemy(&mut self, enemy: flatbuffers::WIPOffset<Monster<'b >>) {
1505 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Monster>>(Monster::VT_ENEMY, enemy);
1506 }
1507 #[inline]
1508 pub fn add_testnestedflatbuffer(&mut self, testnestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
1509 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
1510 }
1511 #[inline]
1512 pub fn add_testempty(&mut self, testempty: flatbuffers::WIPOffset<Stat<'b >>) {
1513 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Stat>>(Monster::VT_TESTEMPTY, testempty);
1514 }
1515 #[inline]
1516 pub fn add_testbool(&mut self, testbool: bool) {
1517 self.fbb_.push_slot::<bool>(Monster::VT_TESTBOOL, testbool, false);
1518 }
1519 #[inline]
1520 pub fn add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32) {
1521 self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
1522 }
1523 #[inline]
1524 pub fn add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32) {
1525 self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
1526 }
1527 #[inline]
1528 pub fn add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64) {
1529 self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
1530 }
1531 #[inline]
1532 pub fn add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64) {
1533 self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
1534 }
1535 #[inline]
1536 pub fn add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32) {
1537 self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
1538 }
1539 #[inline]
1540 pub fn add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32) {
1541 self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
1542 }
1543 #[inline]
1544 pub fn add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64) {
1545 self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
1546 }
1547 #[inline]
1548 pub fn add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64) {
1549 self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
1550 }
1551 #[inline]
1552 pub fn add_testarrayofbools(&mut self, testarrayofbools: flatbuffers::WIPOffset<flatbuffers::Vector<'b , bool>>) {
1553 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
1554 }
1555 #[inline]
1556 pub fn add_testf(&mut self, testf: f32) {
1557 self.fbb_.push_slot::<f32>(Monster::VT_TESTF, testf, 3.14159);
1558 }
1559 #[inline]
1560 pub fn add_testf2(&mut self, testf2: f32) {
1561 self.fbb_.push_slot::<f32>(Monster::VT_TESTF2, testf2, 3.0);
1562 }
1563 #[inline]
1564 pub fn add_testf3(&mut self, testf3: f32) {
1565 self.fbb_.push_slot::<f32>(Monster::VT_TESTF3, testf3, 0.0);
1566 }
1567 #[inline]
1568 pub fn add_testarrayofstring2(&mut self, testarrayofstring2: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
1569 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
1570 }
1571 #[inline]
1572 pub fn add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Ability>>) {
1573 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
1574 }
1575 #[inline]
1576 pub fn add_flex(&mut self, flex: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
1577 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_FLEX, flex);
1578 }
1579 #[inline]
1580 pub fn add_test5(&mut self, test5: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>) {
1581 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST5, test5);
1582 }
1583 #[inline]
1584 pub fn add_vector_of_longs(&mut self, vector_of_longs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i64>>) {
1585 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
1586 }
1587 #[inline]
1588 pub fn add_vector_of_doubles(&mut self, vector_of_doubles: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
1589 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
1590 }
1591 #[inline]
1592 pub fn add_parent_namespace_test(&mut self, parent_namespace_test: flatbuffers::WIPOffset<super::InParentNamespace<'b >>) {
1593 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
1594 }
1595 #[inline]
1596 pub fn add_vector_of_referrables(&mut self, vector_of_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
1597 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
1598 }
1599 #[inline]
1600 pub fn add_single_weak_reference(&mut self, single_weak_reference: u64) {
1601 self.fbb_.push_slot::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
1602 }
1603 #[inline]
1604 pub fn add_vector_of_weak_references(&mut self, vector_of_weak_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
1605 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
1606 }
1607 #[inline]
1608 pub fn add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
1609 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
1610 }
1611 #[inline]
1612 pub fn add_co_owning_reference(&mut self, co_owning_reference: u64) {
1613 self.fbb_.push_slot::<u64>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
1614 }
1615 #[inline]
1616 pub fn add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
1617 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
1618 }
1619 #[inline]
1620 pub fn add_non_owning_reference(&mut self, non_owning_reference: u64) {
1621 self.fbb_.push_slot::<u64>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
1622 }
1623 #[inline]
1624 pub fn add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
1625 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
1626 }
1627 #[inline]
1628 pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) {
1629 self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE);
1630 }
1631 #[inline]
1632 pub fn add_any_unique(&mut self, any_unique: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
1633 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique);
1634 }
1635 #[inline]
1636 pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) {
1637 self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE);
1638 }
1639 #[inline]
1640 pub fn add_any_ambiguous(&mut self, any_ambiguous: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
1641 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
1642 }
1643 #[inline]
1644 pub fn add_vector_of_enums(&mut self, vector_of_enums: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Color>>) {
1645 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
1646 }
1647 #[inline]
1648 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
1649 let start = _fbb.start_table();
1650 MonsterBuilder {
1651 fbb_: _fbb,
1652 start_: start,
1653 }
1654 }
1655 #[inline]
1656 pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
1657 let o = self.fbb_.end_table(self.start_);
1658 self.fbb_.required(o, Monster::VT_NAME,"name");
1659 flatbuffers::WIPOffset::new(o.value())
1660 }
1661}
1662
1663pub enum TypeAliasesOffset {}
1664#[derive(Copy, Clone, Debug, PartialEq)]
1665
1666pub struct TypeAliases<'a> {
1667 pub _tab: flatbuffers::Table<'a>,
1668}
1669
1670impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> {
1671 type Inner = TypeAliases<'a>;
1672 #[inline]
1673 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1674 Self {
1675 _tab: flatbuffers::Table { buf: buf, loc: loc },
1676 }
1677 }
1678}
1679
1680impl<'a> TypeAliases<'a> {
1681 #[inline]
1682 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
1683 TypeAliases {
1684 _tab: table,
1685 }
1686 }
1687 #[allow(unused_mut)]
1688 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
1689 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
1690 args: &'args TypeAliasesArgs<'args>) -> flatbuffers::WIPOffset<TypeAliases<'bldr>> {
1691 let mut builder = TypeAliasesBuilder::new(_fbb);
1692 builder.add_f64_(args.f64_);
1693 builder.add_u64_(args.u64_);
1694 builder.add_i64_(args.i64_);
1695 if let Some(x) = args.vf64 { builder.add_vf64(x); }
1696 if let Some(x) = args.v8 { builder.add_v8(x); }
1697 builder.add_f32_(args.f32_);
1698 builder.add_u32_(args.u32_);
1699 builder.add_i32_(args.i32_);
1700 builder.add_u16_(args.u16_);
1701 builder.add_i16_(args.i16_);
1702 builder.add_u8_(args.u8_);
1703 builder.add_i8_(args.i8_);
1704 builder.finish()
1705 }
1706
1707 pub const VT_I8_: flatbuffers::VOffsetT = 4;
1708 pub const VT_U8_: flatbuffers::VOffsetT = 6;
1709 pub const VT_I16_: flatbuffers::VOffsetT = 8;
1710 pub const VT_U16_: flatbuffers::VOffsetT = 10;
1711 pub const VT_I32_: flatbuffers::VOffsetT = 12;
1712 pub const VT_U32_: flatbuffers::VOffsetT = 14;
1713 pub const VT_I64_: flatbuffers::VOffsetT = 16;
1714 pub const VT_U64_: flatbuffers::VOffsetT = 18;
1715 pub const VT_F32_: flatbuffers::VOffsetT = 20;
1716 pub const VT_F64_: flatbuffers::VOffsetT = 22;
1717 pub const VT_V8: flatbuffers::VOffsetT = 24;
1718 pub const VT_VF64: flatbuffers::VOffsetT = 26;
1719
1720 #[inline]
1721 pub fn i8_(&self) -> i8 {
1722 self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()
1723 }
1724 #[inline]
1725 pub fn u8_(&self) -> u8 {
1726 self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()
1727 }
1728 #[inline]
1729 pub fn i16_(&self) -> i16 {
1730 self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()
1731 }
1732 #[inline]
1733 pub fn u16_(&self) -> u16 {
1734 self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()
1735 }
1736 #[inline]
1737 pub fn i32_(&self) -> i32 {
1738 self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()
1739 }
1740 #[inline]
1741 pub fn u32_(&self) -> u32 {
1742 self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()
1743 }
1744 #[inline]
1745 pub fn i64_(&self) -> i64 {
1746 self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()
1747 }
1748 #[inline]
1749 pub fn u64_(&self) -> u64 {
1750 self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()
1751 }
1752 #[inline]
1753 pub fn f32_(&self) -> f32 {
1754 self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()
1755 }
1756 #[inline]
1757 pub fn f64_(&self) -> f64 {
1758 self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()
1759 }
1760 #[inline]
1761 pub fn v8(&self) -> Option<&'a [i8]> {
1762 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None).map(|v| v.safe_slice())
1763 }
1764 #[inline]
1765 pub fn vf64(&self) -> Option<flatbuffers::Vector<'a, f64>> {
1766 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(TypeAliases::VT_VF64, None)
1767 }
1768}
1769
1770pub struct TypeAliasesArgs<'a> {
1771 pub i8_: i8,
1772 pub u8_: u8,
1773 pub i16_: i16,
1774 pub u16_: u16,
1775 pub i32_: i32,
1776 pub u32_: u32,
1777 pub i64_: i64,
1778 pub u64_: u64,
1779 pub f32_: f32,
1780 pub f64_: f64,
1781 pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , i8>>>,
1782 pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , f64>>>,
1783}
1784impl<'a> Default for TypeAliasesArgs<'a> {
1785 #[inline]
1786 fn default() -> Self {
1787 TypeAliasesArgs {
1788 i8_: 0,
1789 u8_: 0,
1790 i16_: 0,
1791 u16_: 0,
1792 i32_: 0,
1793 u32_: 0,
1794 i64_: 0,
1795 u64_: 0,
1796 f32_: 0.0,
1797 f64_: 0.0,
1798 v8: None,
1799 vf64: None,
1800 }
1801 }
1802}
1803pub struct TypeAliasesBuilder<'a: 'b, 'b> {
1804 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1805 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
1806}
1807impl<'a: 'b, 'b> TypeAliasesBuilder<'a, 'b> {
1808 #[inline]
1809 pub fn add_i8_(&mut self, i8_: i8) {
1810 self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
1811 }
1812 #[inline]
1813 pub fn add_u8_(&mut self, u8_: u8) {
1814 self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0);
1815 }
1816 #[inline]
1817 pub fn add_i16_(&mut self, i16_: i16) {
1818 self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0);
1819 }
1820 #[inline]
1821 pub fn add_u16_(&mut self, u16_: u16) {
1822 self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0);
1823 }
1824 #[inline]
1825 pub fn add_i32_(&mut self, i32_: i32) {
1826 self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0);
1827 }
1828 #[inline]
1829 pub fn add_u32_(&mut self, u32_: u32) {
1830 self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0);
1831 }
1832 #[inline]
1833 pub fn add_i64_(&mut self, i64_: i64) {
1834 self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0);
1835 }
1836 #[inline]
1837 pub fn add_u64_(&mut self, u64_: u64) {
1838 self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0);
1839 }
1840 #[inline]
1841 pub fn add_f32_(&mut self, f32_: f32) {
1842 self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0);
1843 }
1844 #[inline]
1845 pub fn add_f64_(&mut self, f64_: f64) {
1846 self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
1847 }
1848 #[inline]
1849 pub fn add_v8(&mut self, v8: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>) {
1850 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
1851 }
1852 #[inline]
1853 pub fn add_vf64(&mut self, vf64: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
1854 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
1855 }
1856 #[inline]
1857 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TypeAliasesBuilder<'a, 'b> {
1858 let start = _fbb.start_table();
1859 TypeAliasesBuilder {
1860 fbb_: _fbb,
1861 start_: start,
1862 }
1863 }
1864 #[inline]
1865 pub fn finish(self) -> flatbuffers::WIPOffset<TypeAliases<'a>> {
1866 let o = self.fbb_.end_table(self.start_);
1867 flatbuffers::WIPOffset::new(o.value())
1868 }
1869}
1870
1871#[inline]
1872pub fn get_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
1873 flatbuffers::get_root::<Monster<'a>>(buf)
1874}
1875
1876#[inline]
1877pub fn get_size_prefixed_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
1878 flatbuffers::get_size_prefixed_root::<Monster<'a>>(buf)
1879}
1880
1881pub const MONSTER_IDENTIFIER: &'static str = "MONS";
1882
1883#[inline]
1884pub fn monster_buffer_has_identifier(buf: &[u8]) -> bool {
1885 return flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, false);
1886}
1887
1888#[inline]
1889pub fn monster_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
1890 return flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, true);
1891}
1892
1893pub const MONSTER_EXTENSION: &'static str = "mon";
1894
1895#[inline]
1896pub fn finish_monster_buffer<'a, 'b>(
1897 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1898 root: flatbuffers::WIPOffset<Monster<'a>>) {
1899 fbb.finish(root, Some(MONSTER_IDENTIFIER));
1900}
1901
1902#[inline]
1903pub fn finish_size_prefixed_monster_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>) {
1904 fbb.finish_size_prefixed(root, Some(MONSTER_IDENTIFIER));
1905}
1906} // pub mod Example
1907} // pub mod MyGame
1908