1 // automatically generated by the FlatBuffers compiler, do not modify
2
3
4
5 use crate::include_test2_generated::*;
6 use crate::include_test1_generated::*;
7 use std::mem;
8 use std::cmp::Ordering;
9
10 extern crate flatbuffers;
11 use self::flatbuffers::{EndianScalar, Follow};
12
13 #[allow(unused_imports, dead_code)]
14 pub mod my_game {
15
16 use crate::include_test2_generated::*;
17 use crate::include_test1_generated::*;
18 use std::mem;
19 use std::cmp::Ordering;
20
21 extern crate flatbuffers;
22 use self::flatbuffers::{EndianScalar, Follow};
23
24 pub enum InParentNamespaceOffset {}
25 #[derive(Copy, Clone, PartialEq)]
26
27 pub struct InParentNamespace<'a> {
28 pub _tab: flatbuffers::Table<'a>,
29 }
30
31 impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> {
32 type Inner = InParentNamespace<'a>;
33 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner34 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
35 Self { _tab: flatbuffers::Table { buf, loc } }
36 }
37 }
38
39 impl<'a> InParentNamespace<'a> {
get_fully_qualified_name() -> &'static str40 pub const fn get_fully_qualified_name() -> &'static str {
41 "MyGame.InParentNamespace"
42 }
43
44 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self45 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
46 InParentNamespace { _tab: table }
47 }
48 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, _args: &'args InParentNamespaceArgs) -> flatbuffers::WIPOffset<InParentNamespace<'bldr>>49 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
50 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
51 _args: &'args InParentNamespaceArgs) -> flatbuffers::WIPOffset<InParentNamespace<'bldr>> {
52 let mut builder = InParentNamespaceBuilder::new(_fbb);
53 builder.finish()
54 }
55
unpack(&self) -> InParentNamespaceT56 pub fn unpack(&self) -> InParentNamespaceT {
57 InParentNamespaceT {
58 }
59 }
60 }
61
62 impl flatbuffers::Verifiable for InParentNamespace<'_> {
63 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>64 fn run_verifier(
65 v: &mut flatbuffers::Verifier, pos: usize
66 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
67 use self::flatbuffers::Verifiable;
68 v.visit_table(pos)?
69 .finish();
70 Ok(())
71 }
72 }
73 pub struct InParentNamespaceArgs {
74 }
75 impl<'a> Default for InParentNamespaceArgs {
76 #[inline]
default() -> Self77 fn default() -> Self {
78 InParentNamespaceArgs {
79 }
80 }
81 }
82 pub struct InParentNamespaceBuilder<'a: 'b, 'b> {
83 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
84 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
85 }
86 impl<'a: 'b, 'b> InParentNamespaceBuilder<'a, 'b> {
87 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> InParentNamespaceBuilder<'a, 'b>88 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> InParentNamespaceBuilder<'a, 'b> {
89 let start = _fbb.start_table();
90 InParentNamespaceBuilder {
91 fbb_: _fbb,
92 start_: start,
93 }
94 }
95 #[inline]
finish(self) -> flatbuffers::WIPOffset<InParentNamespace<'a>>96 pub fn finish(self) -> flatbuffers::WIPOffset<InParentNamespace<'a>> {
97 let o = self.fbb_.end_table(self.start_);
98 flatbuffers::WIPOffset::new(o.value())
99 }
100 }
101
102 impl std::fmt::Debug for InParentNamespace<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result103 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
104 let mut ds = f.debug_struct("InParentNamespace");
105 ds.finish()
106 }
107 }
108 #[non_exhaustive]
109 #[derive(Debug, Clone, PartialEq)]
110 pub struct InParentNamespaceT {
111 }
112 impl Default for InParentNamespaceT {
default() -> Self113 fn default() -> Self {
114 Self {
115 }
116 }
117 }
118 impl InParentNamespaceT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<InParentNamespace<'b>>119 pub fn pack<'b>(
120 &self,
121 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
122 ) -> flatbuffers::WIPOffset<InParentNamespace<'b>> {
123 InParentNamespace::create(_fbb, &InParentNamespaceArgs{
124 })
125 }
126 }
127 #[allow(unused_imports, dead_code)]
128 pub mod example_2 {
129
130 use crate::include_test2_generated::*;
131 use crate::include_test1_generated::*;
132 use std::mem;
133 use std::cmp::Ordering;
134
135 extern crate flatbuffers;
136 use self::flatbuffers::{EndianScalar, Follow};
137
138 pub enum MonsterOffset {}
139 #[derive(Copy, Clone, PartialEq)]
140
141 pub struct Monster<'a> {
142 pub _tab: flatbuffers::Table<'a>,
143 }
144
145 impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
146 type Inner = Monster<'a>;
147 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner148 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
149 Self { _tab: flatbuffers::Table { buf, loc } }
150 }
151 }
152
153 impl<'a> Monster<'a> {
get_fully_qualified_name() -> &'static str154 pub const fn get_fully_qualified_name() -> &'static str {
155 "MyGame.Example2.Monster"
156 }
157
158 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self159 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
160 Monster { _tab: table }
161 }
162 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, _args: &'args MonsterArgs) -> flatbuffers::WIPOffset<Monster<'bldr>>163 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
164 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
165 _args: &'args MonsterArgs) -> flatbuffers::WIPOffset<Monster<'bldr>> {
166 let mut builder = MonsterBuilder::new(_fbb);
167 builder.finish()
168 }
169
unpack(&self) -> MonsterT170 pub fn unpack(&self) -> MonsterT {
171 MonsterT {
172 }
173 }
174 }
175
176 impl flatbuffers::Verifiable for Monster<'_> {
177 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>178 fn run_verifier(
179 v: &mut flatbuffers::Verifier, pos: usize
180 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
181 use self::flatbuffers::Verifiable;
182 v.visit_table(pos)?
183 .finish();
184 Ok(())
185 }
186 }
187 pub struct MonsterArgs {
188 }
189 impl<'a> Default for MonsterArgs {
190 #[inline]
default() -> Self191 fn default() -> Self {
192 MonsterArgs {
193 }
194 }
195 }
196 pub struct MonsterBuilder<'a: 'b, 'b> {
197 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
198 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
199 }
200 impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
201 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b>202 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
203 let start = _fbb.start_table();
204 MonsterBuilder {
205 fbb_: _fbb,
206 start_: start,
207 }
208 }
209 #[inline]
finish(self) -> flatbuffers::WIPOffset<Monster<'a>>210 pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
211 let o = self.fbb_.end_table(self.start_);
212 flatbuffers::WIPOffset::new(o.value())
213 }
214 }
215
216 impl std::fmt::Debug for Monster<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result217 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
218 let mut ds = f.debug_struct("Monster");
219 ds.finish()
220 }
221 }
222 #[non_exhaustive]
223 #[derive(Debug, Clone, PartialEq)]
224 pub struct MonsterT {
225 }
226 impl Default for MonsterT {
default() -> Self227 fn default() -> Self {
228 Self {
229 }
230 }
231 }
232 impl MonsterT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<Monster<'b>>233 pub fn pack<'b>(
234 &self,
235 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
236 ) -> flatbuffers::WIPOffset<Monster<'b>> {
237 Monster::create(_fbb, &MonsterArgs{
238 })
239 }
240 }
241 } // pub mod Example2
242
243 #[allow(unused_imports, dead_code)]
244 pub mod example {
245
246 use crate::include_test2_generated::*;
247 use crate::include_test1_generated::*;
248 use std::mem;
249 use std::cmp::Ordering;
250
251 extern crate flatbuffers;
252 use self::flatbuffers::{EndianScalar, Follow};
253
254 #[allow(non_upper_case_globals)]
255 mod bitflags_color {
256 flatbuffers::bitflags::bitflags! {
257 /// Composite components of Monster color.
258 #[derive(Default)]
259 pub struct Color: u8 {
260 const Red = 1;
261 /// \brief color Green
262 /// Green is bit_flag with value (1u << 1)
263 const Green = 2;
264 /// \brief color Blue (1u << 3)
265 const Blue = 8;
266 }
267 }
268 }
269 pub use self::bitflags_color::Color;
270
271 impl<'a> flatbuffers::Follow<'a> for Color {
272 type Inner = Self;
273 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner274 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
275 let b = unsafe {
276 flatbuffers::read_scalar_at::<u8>(buf, loc)
277 };
278 unsafe { Self::from_bits_unchecked(b) }
279 }
280 }
281
282 impl flatbuffers::Push for Color {
283 type Output = Color;
284 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])285 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
286 unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.bits()); }
287 }
288 }
289
290 impl flatbuffers::EndianScalar for Color {
291 #[inline]
to_little_endian(self) -> Self292 fn to_little_endian(self) -> Self {
293 let b = u8::to_le(self.bits());
294 unsafe { Self::from_bits_unchecked(b) }
295 }
296 #[inline]
297 #[allow(clippy::wrong_self_convention)]
from_little_endian(self) -> Self298 fn from_little_endian(self) -> Self {
299 let b = u8::from_le(self.bits());
300 unsafe { Self::from_bits_unchecked(b) }
301 }
302 }
303
304 impl<'a> flatbuffers::Verifiable for Color {
305 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>306 fn run_verifier(
307 v: &mut flatbuffers::Verifier, pos: usize
308 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
309 use self::flatbuffers::Verifiable;
310 u8::run_verifier(v, pos)
311 }
312 }
313
314 impl flatbuffers::SimpleToVerifyInSlice for Color {}
315 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
316 pub const ENUM_MIN_RACE: i8 = -1;
317 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
318 pub const ENUM_MAX_RACE: i8 = 2;
319 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
320 #[allow(non_camel_case_types)]
321 pub const ENUM_VALUES_RACE: [Race; 4] = [
322 Race::None,
323 Race::Human,
324 Race::Dwarf,
325 Race::Elf,
326 ];
327
328 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
329 #[repr(transparent)]
330 pub struct Race(pub i8);
331 #[allow(non_upper_case_globals)]
332 impl Race {
333 pub const None: Self = Self(-1);
334 pub const Human: Self = Self(0);
335 pub const Dwarf: Self = Self(1);
336 pub const Elf: Self = Self(2);
337
338 pub const ENUM_MIN: i8 = -1;
339 pub const ENUM_MAX: i8 = 2;
340 pub const ENUM_VALUES: &'static [Self] = &[
341 Self::None,
342 Self::Human,
343 Self::Dwarf,
344 Self::Elf,
345 ];
346 /// Returns the variant's name or "" if unknown.
variant_name(self) -> Option<&'static str>347 pub fn variant_name(self) -> Option<&'static str> {
348 match self {
349 Self::None => Some("None"),
350 Self::Human => Some("Human"),
351 Self::Dwarf => Some("Dwarf"),
352 Self::Elf => Some("Elf"),
353 _ => None,
354 }
355 }
356 }
357 impl std::fmt::Debug for Race {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result358 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
359 if let Some(name) = self.variant_name() {
360 f.write_str(name)
361 } else {
362 f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
363 }
364 }
365 }
366 impl<'a> flatbuffers::Follow<'a> for Race {
367 type Inner = Self;
368 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner369 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
370 let b = unsafe {
371 flatbuffers::read_scalar_at::<i8>(buf, loc)
372 };
373 Self(b)
374 }
375 }
376
377 impl flatbuffers::Push for Race {
378 type Output = Race;
379 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])380 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
381 unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); }
382 }
383 }
384
385 impl flatbuffers::EndianScalar for Race {
386 #[inline]
to_little_endian(self) -> Self387 fn to_little_endian(self) -> Self {
388 let b = i8::to_le(self.0);
389 Self(b)
390 }
391 #[inline]
392 #[allow(clippy::wrong_self_convention)]
from_little_endian(self) -> Self393 fn from_little_endian(self) -> Self {
394 let b = i8::from_le(self.0);
395 Self(b)
396 }
397 }
398
399 impl<'a> flatbuffers::Verifiable for Race {
400 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>401 fn run_verifier(
402 v: &mut flatbuffers::Verifier, pos: usize
403 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
404 use self::flatbuffers::Verifiable;
405 i8::run_verifier(v, pos)
406 }
407 }
408
409 impl flatbuffers::SimpleToVerifyInSlice for Race {}
410 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
411 pub const ENUM_MIN_ANY: u8 = 0;
412 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
413 pub const ENUM_MAX_ANY: u8 = 3;
414 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
415 #[allow(non_camel_case_types)]
416 pub const ENUM_VALUES_ANY: [Any; 4] = [
417 Any::NONE,
418 Any::Monster,
419 Any::TestSimpleTableWithEnum,
420 Any::MyGame_Example2_Monster,
421 ];
422
423 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
424 #[repr(transparent)]
425 pub struct Any(pub u8);
426 #[allow(non_upper_case_globals)]
427 impl Any {
428 pub const NONE: Self = Self(0);
429 pub const Monster: Self = Self(1);
430 pub const TestSimpleTableWithEnum: Self = Self(2);
431 pub const MyGame_Example2_Monster: Self = Self(3);
432
433 pub const ENUM_MIN: u8 = 0;
434 pub const ENUM_MAX: u8 = 3;
435 pub const ENUM_VALUES: &'static [Self] = &[
436 Self::NONE,
437 Self::Monster,
438 Self::TestSimpleTableWithEnum,
439 Self::MyGame_Example2_Monster,
440 ];
441 /// Returns the variant's name or "" if unknown.
variant_name(self) -> Option<&'static str>442 pub fn variant_name(self) -> Option<&'static str> {
443 match self {
444 Self::NONE => Some("NONE"),
445 Self::Monster => Some("Monster"),
446 Self::TestSimpleTableWithEnum => Some("TestSimpleTableWithEnum"),
447 Self::MyGame_Example2_Monster => Some("MyGame_Example2_Monster"),
448 _ => None,
449 }
450 }
451 }
452 impl std::fmt::Debug for Any {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result453 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
454 if let Some(name) = self.variant_name() {
455 f.write_str(name)
456 } else {
457 f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
458 }
459 }
460 }
461 impl<'a> flatbuffers::Follow<'a> for Any {
462 type Inner = Self;
463 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner464 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
465 let b = unsafe {
466 flatbuffers::read_scalar_at::<u8>(buf, loc)
467 };
468 Self(b)
469 }
470 }
471
472 impl flatbuffers::Push for Any {
473 type Output = Any;
474 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])475 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
476 unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
477 }
478 }
479
480 impl flatbuffers::EndianScalar for Any {
481 #[inline]
to_little_endian(self) -> Self482 fn to_little_endian(self) -> Self {
483 let b = u8::to_le(self.0);
484 Self(b)
485 }
486 #[inline]
487 #[allow(clippy::wrong_self_convention)]
from_little_endian(self) -> Self488 fn from_little_endian(self) -> Self {
489 let b = u8::from_le(self.0);
490 Self(b)
491 }
492 }
493
494 impl<'a> flatbuffers::Verifiable for Any {
495 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>496 fn run_verifier(
497 v: &mut flatbuffers::Verifier, pos: usize
498 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
499 use self::flatbuffers::Verifiable;
500 u8::run_verifier(v, pos)
501 }
502 }
503
504 impl flatbuffers::SimpleToVerifyInSlice for Any {}
505 pub struct AnyUnionTableOffset {}
506
507 #[non_exhaustive]
508 #[derive(Debug, Clone, PartialEq)]
509 pub enum AnyT {
510 NONE,
511 Monster(Box<MonsterT>),
512 TestSimpleTableWithEnum(Box<TestSimpleTableWithEnumT>),
513 MyGameExample2Monster(Box<super::example_2::MonsterT>),
514 }
515 impl Default for AnyT {
default() -> Self516 fn default() -> Self {
517 Self::NONE
518 }
519 }
520 impl AnyT {
any_type(&self) -> Any521 pub fn any_type(&self) -> Any {
522 match self {
523 Self::NONE => Any::NONE,
524 Self::Monster(_) => Any::Monster,
525 Self::TestSimpleTableWithEnum(_) => Any::TestSimpleTableWithEnum,
526 Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster,
527 }
528 }
pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>529 pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
530 match self {
531 Self::NONE => None,
532 Self::Monster(v) => Some(v.pack(fbb).as_union_value()),
533 Self::TestSimpleTableWithEnum(v) => Some(v.pack(fbb).as_union_value()),
534 Self::MyGameExample2Monster(v) => Some(v.pack(fbb).as_union_value()),
535 }
536 }
537 /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
take_monster(&mut self) -> Option<Box<MonsterT>>538 pub fn take_monster(&mut self) -> Option<Box<MonsterT>> {
539 if let Self::Monster(_) = self {
540 let v = std::mem::replace(self, Self::NONE);
541 if let Self::Monster(w) = v {
542 Some(w)
543 } else {
544 unreachable!()
545 }
546 } else {
547 None
548 }
549 }
550 /// If the union variant matches, return a reference to the MonsterT.
as_monster(&self) -> Option<&MonsterT>551 pub fn as_monster(&self) -> Option<&MonsterT> {
552 if let Self::Monster(v) = self { Some(v.as_ref()) } else { None }
553 }
554 /// If the union variant matches, return a mutable reference to the MonsterT.
as_monster_mut(&mut self) -> Option<&mut MonsterT>555 pub fn as_monster_mut(&mut self) -> Option<&mut MonsterT> {
556 if let Self::Monster(v) = self { Some(v.as_mut()) } else { None }
557 }
558 /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>>559 pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
560 if let Self::TestSimpleTableWithEnum(_) = self {
561 let v = std::mem::replace(self, Self::NONE);
562 if let Self::TestSimpleTableWithEnum(w) = v {
563 Some(w)
564 } else {
565 unreachable!()
566 }
567 } else {
568 None
569 }
570 }
571 /// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT>572 pub fn as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT> {
573 if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_ref()) } else { None }
574 }
575 /// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT>576 pub fn as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
577 if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None }
578 }
579 /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>>580 pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> {
581 if let Self::MyGameExample2Monster(_) = self {
582 let v = std::mem::replace(self, Self::NONE);
583 if let Self::MyGameExample2Monster(w) = v {
584 Some(w)
585 } else {
586 unreachable!()
587 }
588 } else {
589 None
590 }
591 }
592 /// If the union variant matches, return a reference to the super::example_2::MonsterT.
as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT>593 pub fn as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT> {
594 if let Self::MyGameExample2Monster(v) = self { Some(v.as_ref()) } else { None }
595 }
596 /// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT>597 pub fn as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
598 if let Self::MyGameExample2Monster(v) = self { Some(v.as_mut()) } else { None }
599 }
600 }
601 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
602 pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
603 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
604 pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
605 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
606 #[allow(non_camel_case_types)]
607 pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
608 AnyUniqueAliases::NONE,
609 AnyUniqueAliases::M,
610 AnyUniqueAliases::TS,
611 AnyUniqueAliases::M2,
612 ];
613
614 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
615 #[repr(transparent)]
616 pub struct AnyUniqueAliases(pub u8);
617 #[allow(non_upper_case_globals)]
618 impl AnyUniqueAliases {
619 pub const NONE: Self = Self(0);
620 pub const M: Self = Self(1);
621 pub const TS: Self = Self(2);
622 pub const M2: Self = Self(3);
623
624 pub const ENUM_MIN: u8 = 0;
625 pub const ENUM_MAX: u8 = 3;
626 pub const ENUM_VALUES: &'static [Self] = &[
627 Self::NONE,
628 Self::M,
629 Self::TS,
630 Self::M2,
631 ];
632 /// Returns the variant's name or "" if unknown.
variant_name(self) -> Option<&'static str>633 pub fn variant_name(self) -> Option<&'static str> {
634 match self {
635 Self::NONE => Some("NONE"),
636 Self::M => Some("M"),
637 Self::TS => Some("TS"),
638 Self::M2 => Some("M2"),
639 _ => None,
640 }
641 }
642 }
643 impl std::fmt::Debug for AnyUniqueAliases {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result644 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
645 if let Some(name) = self.variant_name() {
646 f.write_str(name)
647 } else {
648 f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
649 }
650 }
651 }
652 impl<'a> flatbuffers::Follow<'a> for AnyUniqueAliases {
653 type Inner = Self;
654 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner655 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
656 let b = unsafe {
657 flatbuffers::read_scalar_at::<u8>(buf, loc)
658 };
659 Self(b)
660 }
661 }
662
663 impl flatbuffers::Push for AnyUniqueAliases {
664 type Output = AnyUniqueAliases;
665 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])666 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
667 unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
668 }
669 }
670
671 impl flatbuffers::EndianScalar for AnyUniqueAliases {
672 #[inline]
to_little_endian(self) -> Self673 fn to_little_endian(self) -> Self {
674 let b = u8::to_le(self.0);
675 Self(b)
676 }
677 #[inline]
678 #[allow(clippy::wrong_self_convention)]
from_little_endian(self) -> Self679 fn from_little_endian(self) -> Self {
680 let b = u8::from_le(self.0);
681 Self(b)
682 }
683 }
684
685 impl<'a> flatbuffers::Verifiable for AnyUniqueAliases {
686 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>687 fn run_verifier(
688 v: &mut flatbuffers::Verifier, pos: usize
689 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
690 use self::flatbuffers::Verifiable;
691 u8::run_verifier(v, pos)
692 }
693 }
694
695 impl flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
696 pub struct AnyUniqueAliasesUnionTableOffset {}
697
698 #[non_exhaustive]
699 #[derive(Debug, Clone, PartialEq)]
700 pub enum AnyUniqueAliasesT {
701 NONE,
702 M(Box<MonsterT>),
703 TS(Box<TestSimpleTableWithEnumT>),
704 M2(Box<super::example_2::MonsterT>),
705 }
706 impl Default for AnyUniqueAliasesT {
default() -> Self707 fn default() -> Self {
708 Self::NONE
709 }
710 }
711 impl AnyUniqueAliasesT {
any_unique_aliases_type(&self) -> AnyUniqueAliases712 pub fn any_unique_aliases_type(&self) -> AnyUniqueAliases {
713 match self {
714 Self::NONE => AnyUniqueAliases::NONE,
715 Self::M(_) => AnyUniqueAliases::M,
716 Self::TS(_) => AnyUniqueAliases::TS,
717 Self::M2(_) => AnyUniqueAliases::M2,
718 }
719 }
pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>720 pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
721 match self {
722 Self::NONE => None,
723 Self::M(v) => Some(v.pack(fbb).as_union_value()),
724 Self::TS(v) => Some(v.pack(fbb).as_union_value()),
725 Self::M2(v) => Some(v.pack(fbb).as_union_value()),
726 }
727 }
728 /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
take_m(&mut self) -> Option<Box<MonsterT>>729 pub fn take_m(&mut self) -> Option<Box<MonsterT>> {
730 if let Self::M(_) = self {
731 let v = std::mem::replace(self, Self::NONE);
732 if let Self::M(w) = v {
733 Some(w)
734 } else {
735 unreachable!()
736 }
737 } else {
738 None
739 }
740 }
741 /// If the union variant matches, return a reference to the MonsterT.
as_m(&self) -> Option<&MonsterT>742 pub fn as_m(&self) -> Option<&MonsterT> {
743 if let Self::M(v) = self { Some(v.as_ref()) } else { None }
744 }
745 /// If the union variant matches, return a mutable reference to the MonsterT.
as_m_mut(&mut self) -> Option<&mut MonsterT>746 pub fn as_m_mut(&mut self) -> Option<&mut MonsterT> {
747 if let Self::M(v) = self { Some(v.as_mut()) } else { None }
748 }
749 /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>>750 pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
751 if let Self::TS(_) = self {
752 let v = std::mem::replace(self, Self::NONE);
753 if let Self::TS(w) = v {
754 Some(w)
755 } else {
756 unreachable!()
757 }
758 } else {
759 None
760 }
761 }
762 /// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
as_ts(&self) -> Option<&TestSimpleTableWithEnumT>763 pub fn as_ts(&self) -> Option<&TestSimpleTableWithEnumT> {
764 if let Self::TS(v) = self { Some(v.as_ref()) } else { None }
765 }
766 /// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT>767 pub fn as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
768 if let Self::TS(v) = self { Some(v.as_mut()) } else { None }
769 }
770 /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>>771 pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> {
772 if let Self::M2(_) = self {
773 let v = std::mem::replace(self, Self::NONE);
774 if let Self::M2(w) = v {
775 Some(w)
776 } else {
777 unreachable!()
778 }
779 } else {
780 None
781 }
782 }
783 /// If the union variant matches, return a reference to the super::example_2::MonsterT.
as_m2(&self) -> Option<&super::example_2::MonsterT>784 pub fn as_m2(&self) -> Option<&super::example_2::MonsterT> {
785 if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
786 }
787 /// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT>788 pub fn as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
789 if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
790 }
791 }
792 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
793 pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
794 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
795 pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
796 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
797 #[allow(non_camel_case_types)]
798 pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
799 AnyAmbiguousAliases::NONE,
800 AnyAmbiguousAliases::M1,
801 AnyAmbiguousAliases::M2,
802 AnyAmbiguousAliases::M3,
803 ];
804
805 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
806 #[repr(transparent)]
807 pub struct AnyAmbiguousAliases(pub u8);
808 #[allow(non_upper_case_globals)]
809 impl AnyAmbiguousAliases {
810 pub const NONE: Self = Self(0);
811 pub const M1: Self = Self(1);
812 pub const M2: Self = Self(2);
813 pub const M3: Self = Self(3);
814
815 pub const ENUM_MIN: u8 = 0;
816 pub const ENUM_MAX: u8 = 3;
817 pub const ENUM_VALUES: &'static [Self] = &[
818 Self::NONE,
819 Self::M1,
820 Self::M2,
821 Self::M3,
822 ];
823 /// Returns the variant's name or "" if unknown.
variant_name(self) -> Option<&'static str>824 pub fn variant_name(self) -> Option<&'static str> {
825 match self {
826 Self::NONE => Some("NONE"),
827 Self::M1 => Some("M1"),
828 Self::M2 => Some("M2"),
829 Self::M3 => Some("M3"),
830 _ => None,
831 }
832 }
833 }
834 impl std::fmt::Debug for AnyAmbiguousAliases {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result835 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
836 if let Some(name) = self.variant_name() {
837 f.write_str(name)
838 } else {
839 f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
840 }
841 }
842 }
843 impl<'a> flatbuffers::Follow<'a> for AnyAmbiguousAliases {
844 type Inner = Self;
845 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner846 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
847 let b = unsafe {
848 flatbuffers::read_scalar_at::<u8>(buf, loc)
849 };
850 Self(b)
851 }
852 }
853
854 impl flatbuffers::Push for AnyAmbiguousAliases {
855 type Output = AnyAmbiguousAliases;
856 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])857 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
858 unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
859 }
860 }
861
862 impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
863 #[inline]
to_little_endian(self) -> Self864 fn to_little_endian(self) -> Self {
865 let b = u8::to_le(self.0);
866 Self(b)
867 }
868 #[inline]
869 #[allow(clippy::wrong_self_convention)]
from_little_endian(self) -> Self870 fn from_little_endian(self) -> Self {
871 let b = u8::from_le(self.0);
872 Self(b)
873 }
874 }
875
876 impl<'a> flatbuffers::Verifiable for AnyAmbiguousAliases {
877 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>878 fn run_verifier(
879 v: &mut flatbuffers::Verifier, pos: usize
880 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
881 use self::flatbuffers::Verifiable;
882 u8::run_verifier(v, pos)
883 }
884 }
885
886 impl flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
887 pub struct AnyAmbiguousAliasesUnionTableOffset {}
888
889 #[non_exhaustive]
890 #[derive(Debug, Clone, PartialEq)]
891 pub enum AnyAmbiguousAliasesT {
892 NONE,
893 M1(Box<MonsterT>),
894 M2(Box<MonsterT>),
895 M3(Box<MonsterT>),
896 }
897 impl Default for AnyAmbiguousAliasesT {
default() -> Self898 fn default() -> Self {
899 Self::NONE
900 }
901 }
902 impl AnyAmbiguousAliasesT {
any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases903 pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases {
904 match self {
905 Self::NONE => AnyAmbiguousAliases::NONE,
906 Self::M1(_) => AnyAmbiguousAliases::M1,
907 Self::M2(_) => AnyAmbiguousAliases::M2,
908 Self::M3(_) => AnyAmbiguousAliases::M3,
909 }
910 }
pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>911 pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
912 match self {
913 Self::NONE => None,
914 Self::M1(v) => Some(v.pack(fbb).as_union_value()),
915 Self::M2(v) => Some(v.pack(fbb).as_union_value()),
916 Self::M3(v) => Some(v.pack(fbb).as_union_value()),
917 }
918 }
919 /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
take_m1(&mut self) -> Option<Box<MonsterT>>920 pub fn take_m1(&mut self) -> Option<Box<MonsterT>> {
921 if let Self::M1(_) = self {
922 let v = std::mem::replace(self, Self::NONE);
923 if let Self::M1(w) = v {
924 Some(w)
925 } else {
926 unreachable!()
927 }
928 } else {
929 None
930 }
931 }
932 /// If the union variant matches, return a reference to the MonsterT.
as_m1(&self) -> Option<&MonsterT>933 pub fn as_m1(&self) -> Option<&MonsterT> {
934 if let Self::M1(v) = self { Some(v.as_ref()) } else { None }
935 }
936 /// If the union variant matches, return a mutable reference to the MonsterT.
as_m1_mut(&mut self) -> Option<&mut MonsterT>937 pub fn as_m1_mut(&mut self) -> Option<&mut MonsterT> {
938 if let Self::M1(v) = self { Some(v.as_mut()) } else { None }
939 }
940 /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
take_m2(&mut self) -> Option<Box<MonsterT>>941 pub fn take_m2(&mut self) -> Option<Box<MonsterT>> {
942 if let Self::M2(_) = self {
943 let v = std::mem::replace(self, Self::NONE);
944 if let Self::M2(w) = v {
945 Some(w)
946 } else {
947 unreachable!()
948 }
949 } else {
950 None
951 }
952 }
953 /// If the union variant matches, return a reference to the MonsterT.
as_m2(&self) -> Option<&MonsterT>954 pub fn as_m2(&self) -> Option<&MonsterT> {
955 if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
956 }
957 /// If the union variant matches, return a mutable reference to the MonsterT.
as_m2_mut(&mut self) -> Option<&mut MonsterT>958 pub fn as_m2_mut(&mut self) -> Option<&mut MonsterT> {
959 if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
960 }
961 /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
take_m3(&mut self) -> Option<Box<MonsterT>>962 pub fn take_m3(&mut self) -> Option<Box<MonsterT>> {
963 if let Self::M3(_) = self {
964 let v = std::mem::replace(self, Self::NONE);
965 if let Self::M3(w) = v {
966 Some(w)
967 } else {
968 unreachable!()
969 }
970 } else {
971 None
972 }
973 }
974 /// If the union variant matches, return a reference to the MonsterT.
as_m3(&self) -> Option<&MonsterT>975 pub fn as_m3(&self) -> Option<&MonsterT> {
976 if let Self::M3(v) = self { Some(v.as_ref()) } else { None }
977 }
978 /// If the union variant matches, return a mutable reference to the MonsterT.
as_m3_mut(&mut self) -> Option<&mut MonsterT>979 pub fn as_m3_mut(&mut self) -> Option<&mut MonsterT> {
980 if let Self::M3(v) = self { Some(v.as_mut()) } else { None }
981 }
982 }
983 // struct Test, aligned to 2
984 #[repr(transparent)]
985 #[derive(Clone, Copy, PartialEq)]
986 pub struct Test(pub [u8; 4]);
987 impl Default for Test {
default() -> Self988 fn default() -> Self {
989 Self([0; 4])
990 }
991 }
992 impl std::fmt::Debug for Test {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result993 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
994 f.debug_struct("Test")
995 .field("a", &self.a())
996 .field("b", &self.b())
997 .finish()
998 }
999 }
1000
1001 impl flatbuffers::SimpleToVerifyInSlice for Test {}
1002 impl flatbuffers::SafeSliceAccess for Test {}
1003 impl<'a> flatbuffers::Follow<'a> for Test {
1004 type Inner = &'a Test;
1005 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1006 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1007 <&'a Test>::follow(buf, loc)
1008 }
1009 }
1010 impl<'a> flatbuffers::Follow<'a> for &'a Test {
1011 type Inner = &'a Test;
1012 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1013 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1014 flatbuffers::follow_cast_ref::<Test>(buf, loc)
1015 }
1016 }
1017 impl<'b> flatbuffers::Push for Test {
1018 type Output = Test;
1019 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1020 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1021 let src = unsafe {
1022 ::std::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
1023 };
1024 dst.copy_from_slice(src);
1025 }
1026 }
1027 impl<'b> flatbuffers::Push for &'b Test {
1028 type Output = Test;
1029
1030 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1031 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1032 let src = unsafe {
1033 ::std::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
1034 };
1035 dst.copy_from_slice(src);
1036 }
1037 }
1038
1039 impl<'a> flatbuffers::Verifiable for Test {
1040 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>1041 fn run_verifier(
1042 v: &mut flatbuffers::Verifier, pos: usize
1043 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
1044 use self::flatbuffers::Verifiable;
1045 v.in_buffer::<Self>(pos)
1046 }
1047 }
1048 impl<'a> Test {
1049 #[allow(clippy::too_many_arguments)]
new( a: i16, b: i8, ) -> Self1050 pub fn new(
1051 a: i16,
1052 b: i8,
1053 ) -> Self {
1054 let mut s = Self([0; 4]);
1055 s.set_a(a);
1056 s.set_b(b);
1057 s
1058 }
1059
get_fully_qualified_name() -> &'static str1060 pub const fn get_fully_qualified_name() -> &'static str {
1061 "MyGame.Example.Test"
1062 }
1063
a(&self) -> i161064 pub fn a(&self) -> i16 {
1065 let mut mem = core::mem::MaybeUninit::<i16>::uninit();
1066 unsafe {
1067 core::ptr::copy_nonoverlapping(
1068 self.0[0..].as_ptr(),
1069 mem.as_mut_ptr() as *mut u8,
1070 core::mem::size_of::<i16>(),
1071 );
1072 mem.assume_init()
1073 }.from_little_endian()
1074 }
1075
set_a(&mut self, x: i16)1076 pub fn set_a(&mut self, x: i16) {
1077 let x_le = x.to_little_endian();
1078 unsafe {
1079 core::ptr::copy_nonoverlapping(
1080 &x_le as *const i16 as *const u8,
1081 self.0[0..].as_mut_ptr(),
1082 core::mem::size_of::<i16>(),
1083 );
1084 }
1085 }
1086
b(&self) -> i81087 pub fn b(&self) -> i8 {
1088 let mut mem = core::mem::MaybeUninit::<i8>::uninit();
1089 unsafe {
1090 core::ptr::copy_nonoverlapping(
1091 self.0[2..].as_ptr(),
1092 mem.as_mut_ptr() as *mut u8,
1093 core::mem::size_of::<i8>(),
1094 );
1095 mem.assume_init()
1096 }.from_little_endian()
1097 }
1098
set_b(&mut self, x: i8)1099 pub fn set_b(&mut self, x: i8) {
1100 let x_le = x.to_little_endian();
1101 unsafe {
1102 core::ptr::copy_nonoverlapping(
1103 &x_le as *const i8 as *const u8,
1104 self.0[2..].as_mut_ptr(),
1105 core::mem::size_of::<i8>(),
1106 );
1107 }
1108 }
1109
unpack(&self) -> TestT1110 pub fn unpack(&self) -> TestT {
1111 TestT {
1112 a: self.a(),
1113 b: self.b(),
1114 }
1115 }
1116 }
1117
1118 #[derive(Debug, Clone, PartialEq, Default)]
1119 pub struct TestT {
1120 pub a: i16,
1121 pub b: i8,
1122 }
1123 impl TestT {
pack(&self) -> Test1124 pub fn pack(&self) -> Test {
1125 Test::new(
1126 self.a,
1127 self.b,
1128 )
1129 }
1130 }
1131
1132 // struct Vec3, aligned to 8
1133 #[repr(transparent)]
1134 #[derive(Clone, Copy, PartialEq)]
1135 pub struct Vec3(pub [u8; 32]);
1136 impl Default for Vec3 {
default() -> Self1137 fn default() -> Self {
1138 Self([0; 32])
1139 }
1140 }
1141 impl std::fmt::Debug for Vec3 {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result1142 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1143 f.debug_struct("Vec3")
1144 .field("x", &self.x())
1145 .field("y", &self.y())
1146 .field("z", &self.z())
1147 .field("test1", &self.test1())
1148 .field("test2", &self.test2())
1149 .field("test3", &self.test3())
1150 .finish()
1151 }
1152 }
1153
1154 impl flatbuffers::SimpleToVerifyInSlice for Vec3 {}
1155 impl flatbuffers::SafeSliceAccess for Vec3 {}
1156 impl<'a> flatbuffers::Follow<'a> for Vec3 {
1157 type Inner = &'a Vec3;
1158 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1159 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1160 <&'a Vec3>::follow(buf, loc)
1161 }
1162 }
1163 impl<'a> flatbuffers::Follow<'a> for &'a Vec3 {
1164 type Inner = &'a Vec3;
1165 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1166 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1167 flatbuffers::follow_cast_ref::<Vec3>(buf, loc)
1168 }
1169 }
1170 impl<'b> flatbuffers::Push for Vec3 {
1171 type Output = Vec3;
1172 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1173 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1174 let src = unsafe {
1175 ::std::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
1176 };
1177 dst.copy_from_slice(src);
1178 }
1179 }
1180 impl<'b> flatbuffers::Push for &'b Vec3 {
1181 type Output = Vec3;
1182
1183 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1184 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1185 let src = unsafe {
1186 ::std::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
1187 };
1188 dst.copy_from_slice(src);
1189 }
1190 }
1191
1192 impl<'a> flatbuffers::Verifiable for Vec3 {
1193 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>1194 fn run_verifier(
1195 v: &mut flatbuffers::Verifier, pos: usize
1196 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
1197 use self::flatbuffers::Verifiable;
1198 v.in_buffer::<Self>(pos)
1199 }
1200 }
1201 impl<'a> Vec3 {
1202 #[allow(clippy::too_many_arguments)]
new( x: f32, y: f32, z: f32, test1: f64, test2: Color, test3: &Test, ) -> Self1203 pub fn new(
1204 x: f32,
1205 y: f32,
1206 z: f32,
1207 test1: f64,
1208 test2: Color,
1209 test3: &Test,
1210 ) -> Self {
1211 let mut s = Self([0; 32]);
1212 s.set_x(x);
1213 s.set_y(y);
1214 s.set_z(z);
1215 s.set_test1(test1);
1216 s.set_test2(test2);
1217 s.set_test3(&test3);
1218 s
1219 }
1220
get_fully_qualified_name() -> &'static str1221 pub const fn get_fully_qualified_name() -> &'static str {
1222 "MyGame.Example.Vec3"
1223 }
1224
x(&self) -> f321225 pub fn x(&self) -> f32 {
1226 let mut mem = core::mem::MaybeUninit::<f32>::uninit();
1227 unsafe {
1228 core::ptr::copy_nonoverlapping(
1229 self.0[0..].as_ptr(),
1230 mem.as_mut_ptr() as *mut u8,
1231 core::mem::size_of::<f32>(),
1232 );
1233 mem.assume_init()
1234 }.from_little_endian()
1235 }
1236
set_x(&mut self, x: f32)1237 pub fn set_x(&mut self, x: f32) {
1238 let x_le = x.to_little_endian();
1239 unsafe {
1240 core::ptr::copy_nonoverlapping(
1241 &x_le as *const f32 as *const u8,
1242 self.0[0..].as_mut_ptr(),
1243 core::mem::size_of::<f32>(),
1244 );
1245 }
1246 }
1247
y(&self) -> f321248 pub fn y(&self) -> f32 {
1249 let mut mem = core::mem::MaybeUninit::<f32>::uninit();
1250 unsafe {
1251 core::ptr::copy_nonoverlapping(
1252 self.0[4..].as_ptr(),
1253 mem.as_mut_ptr() as *mut u8,
1254 core::mem::size_of::<f32>(),
1255 );
1256 mem.assume_init()
1257 }.from_little_endian()
1258 }
1259
set_y(&mut self, x: f32)1260 pub fn set_y(&mut self, x: f32) {
1261 let x_le = x.to_little_endian();
1262 unsafe {
1263 core::ptr::copy_nonoverlapping(
1264 &x_le as *const f32 as *const u8,
1265 self.0[4..].as_mut_ptr(),
1266 core::mem::size_of::<f32>(),
1267 );
1268 }
1269 }
1270
z(&self) -> f321271 pub fn z(&self) -> f32 {
1272 let mut mem = core::mem::MaybeUninit::<f32>::uninit();
1273 unsafe {
1274 core::ptr::copy_nonoverlapping(
1275 self.0[8..].as_ptr(),
1276 mem.as_mut_ptr() as *mut u8,
1277 core::mem::size_of::<f32>(),
1278 );
1279 mem.assume_init()
1280 }.from_little_endian()
1281 }
1282
set_z(&mut self, x: f32)1283 pub fn set_z(&mut self, x: f32) {
1284 let x_le = x.to_little_endian();
1285 unsafe {
1286 core::ptr::copy_nonoverlapping(
1287 &x_le as *const f32 as *const u8,
1288 self.0[8..].as_mut_ptr(),
1289 core::mem::size_of::<f32>(),
1290 );
1291 }
1292 }
1293
test1(&self) -> f641294 pub fn test1(&self) -> f64 {
1295 let mut mem = core::mem::MaybeUninit::<f64>::uninit();
1296 unsafe {
1297 core::ptr::copy_nonoverlapping(
1298 self.0[16..].as_ptr(),
1299 mem.as_mut_ptr() as *mut u8,
1300 core::mem::size_of::<f64>(),
1301 );
1302 mem.assume_init()
1303 }.from_little_endian()
1304 }
1305
set_test1(&mut self, x: f64)1306 pub fn set_test1(&mut self, x: f64) {
1307 let x_le = x.to_little_endian();
1308 unsafe {
1309 core::ptr::copy_nonoverlapping(
1310 &x_le as *const f64 as *const u8,
1311 self.0[16..].as_mut_ptr(),
1312 core::mem::size_of::<f64>(),
1313 );
1314 }
1315 }
1316
test2(&self) -> Color1317 pub fn test2(&self) -> Color {
1318 let mut mem = core::mem::MaybeUninit::<Color>::uninit();
1319 unsafe {
1320 core::ptr::copy_nonoverlapping(
1321 self.0[24..].as_ptr(),
1322 mem.as_mut_ptr() as *mut u8,
1323 core::mem::size_of::<Color>(),
1324 );
1325 mem.assume_init()
1326 }.from_little_endian()
1327 }
1328
set_test2(&mut self, x: Color)1329 pub fn set_test2(&mut self, x: Color) {
1330 let x_le = x.to_little_endian();
1331 unsafe {
1332 core::ptr::copy_nonoverlapping(
1333 &x_le as *const Color as *const u8,
1334 self.0[24..].as_mut_ptr(),
1335 core::mem::size_of::<Color>(),
1336 );
1337 }
1338 }
1339
test3(&self) -> &Test1340 pub fn test3(&self) -> &Test {
1341 unsafe { &*(self.0[26..].as_ptr() as *const Test) }
1342 }
1343
set_test3(&mut self, x: &Test)1344 pub fn set_test3(&mut self, x: &Test) {
1345 self.0[26..26+4].copy_from_slice(&x.0)
1346 }
1347
unpack(&self) -> Vec3T1348 pub fn unpack(&self) -> Vec3T {
1349 Vec3T {
1350 x: self.x(),
1351 y: self.y(),
1352 z: self.z(),
1353 test1: self.test1(),
1354 test2: self.test2(),
1355 test3: self.test3().unpack(),
1356 }
1357 }
1358 }
1359
1360 #[derive(Debug, Clone, PartialEq, Default)]
1361 pub struct Vec3T {
1362 pub x: f32,
1363 pub y: f32,
1364 pub z: f32,
1365 pub test1: f64,
1366 pub test2: Color,
1367 pub test3: TestT,
1368 }
1369 impl Vec3T {
pack(&self) -> Vec31370 pub fn pack(&self) -> Vec3 {
1371 Vec3::new(
1372 self.x,
1373 self.y,
1374 self.z,
1375 self.test1,
1376 self.test2,
1377 &self.test3.pack(),
1378 )
1379 }
1380 }
1381
1382 // struct Ability, aligned to 4
1383 #[repr(transparent)]
1384 #[derive(Clone, Copy, PartialEq)]
1385 pub struct Ability(pub [u8; 8]);
1386 impl Default for Ability {
default() -> Self1387 fn default() -> Self {
1388 Self([0; 8])
1389 }
1390 }
1391 impl std::fmt::Debug for Ability {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result1392 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1393 f.debug_struct("Ability")
1394 .field("id", &self.id())
1395 .field("distance", &self.distance())
1396 .finish()
1397 }
1398 }
1399
1400 impl flatbuffers::SimpleToVerifyInSlice for Ability {}
1401 impl flatbuffers::SafeSliceAccess for Ability {}
1402 impl<'a> flatbuffers::Follow<'a> for Ability {
1403 type Inner = &'a Ability;
1404 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1405 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1406 <&'a Ability>::follow(buf, loc)
1407 }
1408 }
1409 impl<'a> flatbuffers::Follow<'a> for &'a Ability {
1410 type Inner = &'a Ability;
1411 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1412 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1413 flatbuffers::follow_cast_ref::<Ability>(buf, loc)
1414 }
1415 }
1416 impl<'b> flatbuffers::Push for Ability {
1417 type Output = Ability;
1418 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1419 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1420 let src = unsafe {
1421 ::std::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
1422 };
1423 dst.copy_from_slice(src);
1424 }
1425 }
1426 impl<'b> flatbuffers::Push for &'b Ability {
1427 type Output = Ability;
1428
1429 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1430 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1431 let src = unsafe {
1432 ::std::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
1433 };
1434 dst.copy_from_slice(src);
1435 }
1436 }
1437
1438 impl<'a> flatbuffers::Verifiable for Ability {
1439 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>1440 fn run_verifier(
1441 v: &mut flatbuffers::Verifier, pos: usize
1442 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
1443 use self::flatbuffers::Verifiable;
1444 v.in_buffer::<Self>(pos)
1445 }
1446 }
1447 impl<'a> Ability {
1448 #[allow(clippy::too_many_arguments)]
new( id: u32, distance: u32, ) -> Self1449 pub fn new(
1450 id: u32,
1451 distance: u32,
1452 ) -> Self {
1453 let mut s = Self([0; 8]);
1454 s.set_id(id);
1455 s.set_distance(distance);
1456 s
1457 }
1458
get_fully_qualified_name() -> &'static str1459 pub const fn get_fully_qualified_name() -> &'static str {
1460 "MyGame.Example.Ability"
1461 }
1462
id(&self) -> u321463 pub fn id(&self) -> u32 {
1464 let mut mem = core::mem::MaybeUninit::<u32>::uninit();
1465 unsafe {
1466 core::ptr::copy_nonoverlapping(
1467 self.0[0..].as_ptr(),
1468 mem.as_mut_ptr() as *mut u8,
1469 core::mem::size_of::<u32>(),
1470 );
1471 mem.assume_init()
1472 }.from_little_endian()
1473 }
1474
set_id(&mut self, x: u32)1475 pub fn set_id(&mut self, x: u32) {
1476 let x_le = x.to_little_endian();
1477 unsafe {
1478 core::ptr::copy_nonoverlapping(
1479 &x_le as *const u32 as *const u8,
1480 self.0[0..].as_mut_ptr(),
1481 core::mem::size_of::<u32>(),
1482 );
1483 }
1484 }
1485
1486 #[inline]
key_compare_less_than(&self, o: &Ability) -> bool1487 pub fn key_compare_less_than(&self, o: &Ability) -> bool {
1488 self.id() < o.id()
1489 }
1490
1491 #[inline]
key_compare_with_value(&self, val: u32) -> ::std::cmp::Ordering1492 pub fn key_compare_with_value(&self, val: u32) -> ::std::cmp::Ordering {
1493 let key = self.id();
1494 key.cmp(&val)
1495 }
distance(&self) -> u321496 pub fn distance(&self) -> u32 {
1497 let mut mem = core::mem::MaybeUninit::<u32>::uninit();
1498 unsafe {
1499 core::ptr::copy_nonoverlapping(
1500 self.0[4..].as_ptr(),
1501 mem.as_mut_ptr() as *mut u8,
1502 core::mem::size_of::<u32>(),
1503 );
1504 mem.assume_init()
1505 }.from_little_endian()
1506 }
1507
set_distance(&mut self, x: u32)1508 pub fn set_distance(&mut self, x: u32) {
1509 let x_le = x.to_little_endian();
1510 unsafe {
1511 core::ptr::copy_nonoverlapping(
1512 &x_le as *const u32 as *const u8,
1513 self.0[4..].as_mut_ptr(),
1514 core::mem::size_of::<u32>(),
1515 );
1516 }
1517 }
1518
unpack(&self) -> AbilityT1519 pub fn unpack(&self) -> AbilityT {
1520 AbilityT {
1521 id: self.id(),
1522 distance: self.distance(),
1523 }
1524 }
1525 }
1526
1527 #[derive(Debug, Clone, PartialEq, Default)]
1528 pub struct AbilityT {
1529 pub id: u32,
1530 pub distance: u32,
1531 }
1532 impl AbilityT {
pack(&self) -> Ability1533 pub fn pack(&self) -> Ability {
1534 Ability::new(
1535 self.id,
1536 self.distance,
1537 )
1538 }
1539 }
1540
1541 // struct StructOfStructs, aligned to 4
1542 #[repr(transparent)]
1543 #[derive(Clone, Copy, PartialEq)]
1544 pub struct StructOfStructs(pub [u8; 20]);
1545 impl Default for StructOfStructs {
default() -> Self1546 fn default() -> Self {
1547 Self([0; 20])
1548 }
1549 }
1550 impl std::fmt::Debug for StructOfStructs {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result1551 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1552 f.debug_struct("StructOfStructs")
1553 .field("a", &self.a())
1554 .field("b", &self.b())
1555 .field("c", &self.c())
1556 .finish()
1557 }
1558 }
1559
1560 impl flatbuffers::SimpleToVerifyInSlice for StructOfStructs {}
1561 impl flatbuffers::SafeSliceAccess for StructOfStructs {}
1562 impl<'a> flatbuffers::Follow<'a> for StructOfStructs {
1563 type Inner = &'a StructOfStructs;
1564 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1565 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1566 <&'a StructOfStructs>::follow(buf, loc)
1567 }
1568 }
1569 impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructs {
1570 type Inner = &'a StructOfStructs;
1571 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1572 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1573 flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc)
1574 }
1575 }
1576 impl<'b> flatbuffers::Push for StructOfStructs {
1577 type Output = StructOfStructs;
1578 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1579 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1580 let src = unsafe {
1581 ::std::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
1582 };
1583 dst.copy_from_slice(src);
1584 }
1585 }
1586 impl<'b> flatbuffers::Push for &'b StructOfStructs {
1587 type Output = StructOfStructs;
1588
1589 #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])1590 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
1591 let src = unsafe {
1592 ::std::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
1593 };
1594 dst.copy_from_slice(src);
1595 }
1596 }
1597
1598 impl<'a> flatbuffers::Verifiable for StructOfStructs {
1599 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>1600 fn run_verifier(
1601 v: &mut flatbuffers::Verifier, pos: usize
1602 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
1603 use self::flatbuffers::Verifiable;
1604 v.in_buffer::<Self>(pos)
1605 }
1606 }
1607 impl<'a> StructOfStructs {
1608 #[allow(clippy::too_many_arguments)]
new( a: &Ability, b: &Test, c: &Ability, ) -> Self1609 pub fn new(
1610 a: &Ability,
1611 b: &Test,
1612 c: &Ability,
1613 ) -> Self {
1614 let mut s = Self([0; 20]);
1615 s.set_a(&a);
1616 s.set_b(&b);
1617 s.set_c(&c);
1618 s
1619 }
1620
get_fully_qualified_name() -> &'static str1621 pub const fn get_fully_qualified_name() -> &'static str {
1622 "MyGame.Example.StructOfStructs"
1623 }
1624
a(&self) -> &Ability1625 pub fn a(&self) -> &Ability {
1626 unsafe { &*(self.0[0..].as_ptr() as *const Ability) }
1627 }
1628
set_a(&mut self, x: &Ability)1629 pub fn set_a(&mut self, x: &Ability) {
1630 self.0[0..0+8].copy_from_slice(&x.0)
1631 }
1632
b(&self) -> &Test1633 pub fn b(&self) -> &Test {
1634 unsafe { &*(self.0[8..].as_ptr() as *const Test) }
1635 }
1636
set_b(&mut self, x: &Test)1637 pub fn set_b(&mut self, x: &Test) {
1638 self.0[8..8+4].copy_from_slice(&x.0)
1639 }
1640
c(&self) -> &Ability1641 pub fn c(&self) -> &Ability {
1642 unsafe { &*(self.0[12..].as_ptr() as *const Ability) }
1643 }
1644
set_c(&mut self, x: &Ability)1645 pub fn set_c(&mut self, x: &Ability) {
1646 self.0[12..12+8].copy_from_slice(&x.0)
1647 }
1648
unpack(&self) -> StructOfStructsT1649 pub fn unpack(&self) -> StructOfStructsT {
1650 StructOfStructsT {
1651 a: self.a().unpack(),
1652 b: self.b().unpack(),
1653 c: self.c().unpack(),
1654 }
1655 }
1656 }
1657
1658 #[derive(Debug, Clone, PartialEq, Default)]
1659 pub struct StructOfStructsT {
1660 pub a: AbilityT,
1661 pub b: TestT,
1662 pub c: AbilityT,
1663 }
1664 impl StructOfStructsT {
pack(&self) -> StructOfStructs1665 pub fn pack(&self) -> StructOfStructs {
1666 StructOfStructs::new(
1667 &self.a.pack(),
1668 &self.b.pack(),
1669 &self.c.pack(),
1670 )
1671 }
1672 }
1673
1674 pub enum TestSimpleTableWithEnumOffset {}
1675 #[derive(Copy, Clone, PartialEq)]
1676
1677 pub struct TestSimpleTableWithEnum<'a> {
1678 pub _tab: flatbuffers::Table<'a>,
1679 }
1680
1681 impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
1682 type Inner = TestSimpleTableWithEnum<'a>;
1683 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1684 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1685 Self { _tab: flatbuffers::Table { buf, loc } }
1686 }
1687 }
1688
1689 impl<'a> TestSimpleTableWithEnum<'a> {
get_fully_qualified_name() -> &'static str1690 pub const fn get_fully_qualified_name() -> &'static str {
1691 "MyGame.Example.TestSimpleTableWithEnum"
1692 }
1693
1694 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self1695 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
1696 TestSimpleTableWithEnum { _tab: table }
1697 }
1698 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args TestSimpleTableWithEnumArgs) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>>1699 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
1700 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
1701 args: &'args TestSimpleTableWithEnumArgs) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> {
1702 let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb);
1703 builder.add_color(args.color);
1704 builder.finish()
1705 }
1706
unpack(&self) -> TestSimpleTableWithEnumT1707 pub fn unpack(&self) -> TestSimpleTableWithEnumT {
1708 let color = self.color();
1709 TestSimpleTableWithEnumT {
1710 color,
1711 }
1712 }
1713 pub const VT_COLOR: flatbuffers::VOffsetT = 4;
1714
1715 #[inline]
color(&self) -> Color1716 pub fn color(&self) -> Color {
1717 self._tab.get::<Color>(TestSimpleTableWithEnum::VT_COLOR, Some(Color::Green)).unwrap()
1718 }
1719 }
1720
1721 impl flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
1722 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>1723 fn run_verifier(
1724 v: &mut flatbuffers::Verifier, pos: usize
1725 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
1726 use self::flatbuffers::Verifiable;
1727 v.visit_table(pos)?
1728 .visit_field::<Color>(&"color", Self::VT_COLOR, false)?
1729 .finish();
1730 Ok(())
1731 }
1732 }
1733 pub struct TestSimpleTableWithEnumArgs {
1734 pub color: Color,
1735 }
1736 impl<'a> Default for TestSimpleTableWithEnumArgs {
1737 #[inline]
default() -> Self1738 fn default() -> Self {
1739 TestSimpleTableWithEnumArgs {
1740 color: Color::Green,
1741 }
1742 }
1743 }
1744 pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b> {
1745 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1746 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
1747 }
1748 impl<'a: 'b, 'b> TestSimpleTableWithEnumBuilder<'a, 'b> {
1749 #[inline]
add_color(&mut self, color: Color)1750 pub fn add_color(&mut self, color: Color) {
1751 self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
1752 }
1753 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TestSimpleTableWithEnumBuilder<'a, 'b>1754 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TestSimpleTableWithEnumBuilder<'a, 'b> {
1755 let start = _fbb.start_table();
1756 TestSimpleTableWithEnumBuilder {
1757 fbb_: _fbb,
1758 start_: start,
1759 }
1760 }
1761 #[inline]
finish(self) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>>1762 pub fn finish(self) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
1763 let o = self.fbb_.end_table(self.start_);
1764 flatbuffers::WIPOffset::new(o.value())
1765 }
1766 }
1767
1768 impl std::fmt::Debug for TestSimpleTableWithEnum<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result1769 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1770 let mut ds = f.debug_struct("TestSimpleTableWithEnum");
1771 ds.field("color", &self.color());
1772 ds.finish()
1773 }
1774 }
1775 #[non_exhaustive]
1776 #[derive(Debug, Clone, PartialEq)]
1777 pub struct TestSimpleTableWithEnumT {
1778 pub color: Color,
1779 }
1780 impl Default for TestSimpleTableWithEnumT {
default() -> Self1781 fn default() -> Self {
1782 Self {
1783 color: Color::Green,
1784 }
1785 }
1786 }
1787 impl TestSimpleTableWithEnumT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>>1788 pub fn pack<'b>(
1789 &self,
1790 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
1791 ) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>> {
1792 let color = self.color;
1793 TestSimpleTableWithEnum::create(_fbb, &TestSimpleTableWithEnumArgs{
1794 color,
1795 })
1796 }
1797 }
1798 pub enum StatOffset {}
1799 #[derive(Copy, Clone, PartialEq)]
1800
1801 pub struct Stat<'a> {
1802 pub _tab: flatbuffers::Table<'a>,
1803 }
1804
1805 impl<'a> flatbuffers::Follow<'a> for Stat<'a> {
1806 type Inner = Stat<'a>;
1807 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1808 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1809 Self { _tab: flatbuffers::Table { buf, loc } }
1810 }
1811 }
1812
1813 impl<'a> Stat<'a> {
get_fully_qualified_name() -> &'static str1814 pub const fn get_fully_qualified_name() -> &'static str {
1815 "MyGame.Example.Stat"
1816 }
1817
1818 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self1819 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
1820 Stat { _tab: table }
1821 }
1822 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args StatArgs<'args>) -> flatbuffers::WIPOffset<Stat<'bldr>>1823 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
1824 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
1825 args: &'args StatArgs<'args>) -> flatbuffers::WIPOffset<Stat<'bldr>> {
1826 let mut builder = StatBuilder::new(_fbb);
1827 builder.add_val(args.val);
1828 if let Some(x) = args.id { builder.add_id(x); }
1829 builder.add_count(args.count);
1830 builder.finish()
1831 }
1832
unpack(&self) -> StatT1833 pub fn unpack(&self) -> StatT {
1834 let id = self.id().map(|x| {
1835 x.to_string()
1836 });
1837 let val = self.val();
1838 let count = self.count();
1839 StatT {
1840 id,
1841 val,
1842 count,
1843 }
1844 }
1845 pub const VT_ID: flatbuffers::VOffsetT = 4;
1846 pub const VT_VAL: flatbuffers::VOffsetT = 6;
1847 pub const VT_COUNT: flatbuffers::VOffsetT = 8;
1848
1849 #[inline]
id(&self) -> Option<&'a str>1850 pub fn id(&self) -> Option<&'a str> {
1851 self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)
1852 }
1853 #[inline]
val(&self) -> i641854 pub fn val(&self) -> i64 {
1855 self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()
1856 }
1857 #[inline]
count(&self) -> u161858 pub fn count(&self) -> u16 {
1859 self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()
1860 }
1861 #[inline]
key_compare_less_than(&self, o: &Stat) -> bool1862 pub fn key_compare_less_than(&self, o: &Stat) -> bool {
1863 self.count() < o.count()
1864 }
1865
1866 #[inline]
key_compare_with_value(&self, val: u16) -> ::std::cmp::Ordering1867 pub fn key_compare_with_value(&self, val: u16) -> ::std::cmp::Ordering {
1868 let key = self.count();
1869 key.cmp(&val)
1870 }
1871 }
1872
1873 impl flatbuffers::Verifiable for Stat<'_> {
1874 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>1875 fn run_verifier(
1876 v: &mut flatbuffers::Verifier, pos: usize
1877 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
1878 use self::flatbuffers::Verifiable;
1879 v.visit_table(pos)?
1880 .visit_field::<flatbuffers::ForwardsUOffset<&str>>(&"id", Self::VT_ID, false)?
1881 .visit_field::<i64>(&"val", Self::VT_VAL, false)?
1882 .visit_field::<u16>(&"count", Self::VT_COUNT, false)?
1883 .finish();
1884 Ok(())
1885 }
1886 }
1887 pub struct StatArgs<'a> {
1888 pub id: Option<flatbuffers::WIPOffset<&'a str>>,
1889 pub val: i64,
1890 pub count: u16,
1891 }
1892 impl<'a> Default for StatArgs<'a> {
1893 #[inline]
default() -> Self1894 fn default() -> Self {
1895 StatArgs {
1896 id: None,
1897 val: 0,
1898 count: 0,
1899 }
1900 }
1901 }
1902 pub struct StatBuilder<'a: 'b, 'b> {
1903 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1904 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
1905 }
1906 impl<'a: 'b, 'b> StatBuilder<'a, 'b> {
1907 #[inline]
add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>)1908 pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) {
1909 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
1910 }
1911 #[inline]
add_val(&mut self, val: i64)1912 pub fn add_val(&mut self, val: i64) {
1913 self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0);
1914 }
1915 #[inline]
add_count(&mut self, count: u16)1916 pub fn add_count(&mut self, count: u16) {
1917 self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
1918 }
1919 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> StatBuilder<'a, 'b>1920 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> StatBuilder<'a, 'b> {
1921 let start = _fbb.start_table();
1922 StatBuilder {
1923 fbb_: _fbb,
1924 start_: start,
1925 }
1926 }
1927 #[inline]
finish(self) -> flatbuffers::WIPOffset<Stat<'a>>1928 pub fn finish(self) -> flatbuffers::WIPOffset<Stat<'a>> {
1929 let o = self.fbb_.end_table(self.start_);
1930 flatbuffers::WIPOffset::new(o.value())
1931 }
1932 }
1933
1934 impl std::fmt::Debug for Stat<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result1935 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1936 let mut ds = f.debug_struct("Stat");
1937 ds.field("id", &self.id());
1938 ds.field("val", &self.val());
1939 ds.field("count", &self.count());
1940 ds.finish()
1941 }
1942 }
1943 #[non_exhaustive]
1944 #[derive(Debug, Clone, PartialEq)]
1945 pub struct StatT {
1946 pub id: Option<String>,
1947 pub val: i64,
1948 pub count: u16,
1949 }
1950 impl Default for StatT {
default() -> Self1951 fn default() -> Self {
1952 Self {
1953 id: None,
1954 val: 0,
1955 count: 0,
1956 }
1957 }
1958 }
1959 impl StatT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<Stat<'b>>1960 pub fn pack<'b>(
1961 &self,
1962 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
1963 ) -> flatbuffers::WIPOffset<Stat<'b>> {
1964 let id = self.id.as_ref().map(|x|{
1965 _fbb.create_string(x)
1966 });
1967 let val = self.val;
1968 let count = self.count;
1969 Stat::create(_fbb, &StatArgs{
1970 id,
1971 val,
1972 count,
1973 })
1974 }
1975 }
1976 pub enum ReferrableOffset {}
1977 #[derive(Copy, Clone, PartialEq)]
1978
1979 pub struct Referrable<'a> {
1980 pub _tab: flatbuffers::Table<'a>,
1981 }
1982
1983 impl<'a> flatbuffers::Follow<'a> for Referrable<'a> {
1984 type Inner = Referrable<'a>;
1985 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner1986 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1987 Self { _tab: flatbuffers::Table { buf, loc } }
1988 }
1989 }
1990
1991 impl<'a> Referrable<'a> {
get_fully_qualified_name() -> &'static str1992 pub const fn get_fully_qualified_name() -> &'static str {
1993 "MyGame.Example.Referrable"
1994 }
1995
1996 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self1997 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
1998 Referrable { _tab: table }
1999 }
2000 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args ReferrableArgs) -> flatbuffers::WIPOffset<Referrable<'bldr>>2001 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
2002 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
2003 args: &'args ReferrableArgs) -> flatbuffers::WIPOffset<Referrable<'bldr>> {
2004 let mut builder = ReferrableBuilder::new(_fbb);
2005 builder.add_id(args.id);
2006 builder.finish()
2007 }
2008
unpack(&self) -> ReferrableT2009 pub fn unpack(&self) -> ReferrableT {
2010 let id = self.id();
2011 ReferrableT {
2012 id,
2013 }
2014 }
2015 pub const VT_ID: flatbuffers::VOffsetT = 4;
2016
2017 #[inline]
id(&self) -> u642018 pub fn id(&self) -> u64 {
2019 self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()
2020 }
2021 #[inline]
key_compare_less_than(&self, o: &Referrable) -> bool2022 pub fn key_compare_less_than(&self, o: &Referrable) -> bool {
2023 self.id() < o.id()
2024 }
2025
2026 #[inline]
key_compare_with_value(&self, val: u64) -> ::std::cmp::Ordering2027 pub fn key_compare_with_value(&self, val: u64) -> ::std::cmp::Ordering {
2028 let key = self.id();
2029 key.cmp(&val)
2030 }
2031 }
2032
2033 impl flatbuffers::Verifiable for Referrable<'_> {
2034 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>2035 fn run_verifier(
2036 v: &mut flatbuffers::Verifier, pos: usize
2037 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
2038 use self::flatbuffers::Verifiable;
2039 v.visit_table(pos)?
2040 .visit_field::<u64>(&"id", Self::VT_ID, false)?
2041 .finish();
2042 Ok(())
2043 }
2044 }
2045 pub struct ReferrableArgs {
2046 pub id: u64,
2047 }
2048 impl<'a> Default for ReferrableArgs {
2049 #[inline]
default() -> Self2050 fn default() -> Self {
2051 ReferrableArgs {
2052 id: 0,
2053 }
2054 }
2055 }
2056 pub struct ReferrableBuilder<'a: 'b, 'b> {
2057 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
2058 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
2059 }
2060 impl<'a: 'b, 'b> ReferrableBuilder<'a, 'b> {
2061 #[inline]
add_id(&mut self, id: u64)2062 pub fn add_id(&mut self, id: u64) {
2063 self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
2064 }
2065 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ReferrableBuilder<'a, 'b>2066 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ReferrableBuilder<'a, 'b> {
2067 let start = _fbb.start_table();
2068 ReferrableBuilder {
2069 fbb_: _fbb,
2070 start_: start,
2071 }
2072 }
2073 #[inline]
finish(self) -> flatbuffers::WIPOffset<Referrable<'a>>2074 pub fn finish(self) -> flatbuffers::WIPOffset<Referrable<'a>> {
2075 let o = self.fbb_.end_table(self.start_);
2076 flatbuffers::WIPOffset::new(o.value())
2077 }
2078 }
2079
2080 impl std::fmt::Debug for Referrable<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result2081 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2082 let mut ds = f.debug_struct("Referrable");
2083 ds.field("id", &self.id());
2084 ds.finish()
2085 }
2086 }
2087 #[non_exhaustive]
2088 #[derive(Debug, Clone, PartialEq)]
2089 pub struct ReferrableT {
2090 pub id: u64,
2091 }
2092 impl Default for ReferrableT {
default() -> Self2093 fn default() -> Self {
2094 Self {
2095 id: 0,
2096 }
2097 }
2098 }
2099 impl ReferrableT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<Referrable<'b>>2100 pub fn pack<'b>(
2101 &self,
2102 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
2103 ) -> flatbuffers::WIPOffset<Referrable<'b>> {
2104 let id = self.id;
2105 Referrable::create(_fbb, &ReferrableArgs{
2106 id,
2107 })
2108 }
2109 }
2110 pub enum MonsterOffset {}
2111 #[derive(Copy, Clone, PartialEq)]
2112
2113 /// an example documentation comment: "monster object"
2114 pub struct Monster<'a> {
2115 pub _tab: flatbuffers::Table<'a>,
2116 }
2117
2118 impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
2119 type Inner = Monster<'a>;
2120 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner2121 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
2122 Self { _tab: flatbuffers::Table { buf, loc } }
2123 }
2124 }
2125
2126 impl<'a> Monster<'a> {
get_fully_qualified_name() -> &'static str2127 pub const fn get_fully_qualified_name() -> &'static str {
2128 "MyGame.Example.Monster"
2129 }
2130
2131 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self2132 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
2133 Monster { _tab: table }
2134 }
2135 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args MonsterArgs<'args>) -> flatbuffers::WIPOffset<Monster<'bldr>>2136 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
2137 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
2138 args: &'args MonsterArgs<'args>) -> flatbuffers::WIPOffset<Monster<'bldr>> {
2139 let mut builder = MonsterBuilder::new(_fbb);
2140 builder.add_non_owning_reference(args.non_owning_reference);
2141 builder.add_co_owning_reference(args.co_owning_reference);
2142 builder.add_single_weak_reference(args.single_weak_reference);
2143 builder.add_testhashu64_fnv1a(args.testhashu64_fnv1a);
2144 builder.add_testhashs64_fnv1a(args.testhashs64_fnv1a);
2145 builder.add_testhashu64_fnv1(args.testhashu64_fnv1);
2146 builder.add_testhashs64_fnv1(args.testhashs64_fnv1);
2147 if let Some(x) = args.scalar_key_sorted_tables { builder.add_scalar_key_sorted_tables(x); }
2148 if let Some(x) = args.testrequirednestedflatbuffer { builder.add_testrequirednestedflatbuffer(x); }
2149 if let Some(x) = args.vector_of_enums { builder.add_vector_of_enums(x); }
2150 if let Some(x) = args.any_ambiguous { builder.add_any_ambiguous(x); }
2151 if let Some(x) = args.any_unique { builder.add_any_unique(x); }
2152 if let Some(x) = args.vector_of_non_owning_references { builder.add_vector_of_non_owning_references(x); }
2153 if let Some(x) = args.vector_of_co_owning_references { builder.add_vector_of_co_owning_references(x); }
2154 if let Some(x) = args.vector_of_strong_referrables { builder.add_vector_of_strong_referrables(x); }
2155 if let Some(x) = args.vector_of_weak_references { builder.add_vector_of_weak_references(x); }
2156 if let Some(x) = args.vector_of_referrables { builder.add_vector_of_referrables(x); }
2157 if let Some(x) = args.parent_namespace_test { builder.add_parent_namespace_test(x); }
2158 if let Some(x) = args.vector_of_doubles { builder.add_vector_of_doubles(x); }
2159 if let Some(x) = args.vector_of_longs { builder.add_vector_of_longs(x); }
2160 if let Some(x) = args.test5 { builder.add_test5(x); }
2161 if let Some(x) = args.flex { builder.add_flex(x); }
2162 if let Some(x) = args.testarrayofsortedstruct { builder.add_testarrayofsortedstruct(x); }
2163 if let Some(x) = args.testarrayofstring2 { builder.add_testarrayofstring2(x); }
2164 builder.add_testf3(args.testf3);
2165 builder.add_testf2(args.testf2);
2166 builder.add_testf(args.testf);
2167 if let Some(x) = args.testarrayofbools { builder.add_testarrayofbools(x); }
2168 builder.add_testhashu32_fnv1a(args.testhashu32_fnv1a);
2169 builder.add_testhashs32_fnv1a(args.testhashs32_fnv1a);
2170 builder.add_testhashu32_fnv1(args.testhashu32_fnv1);
2171 builder.add_testhashs32_fnv1(args.testhashs32_fnv1);
2172 if let Some(x) = args.testempty { builder.add_testempty(x); }
2173 if let Some(x) = args.testnestedflatbuffer { builder.add_testnestedflatbuffer(x); }
2174 if let Some(x) = args.enemy { builder.add_enemy(x); }
2175 if let Some(x) = args.testarrayoftables { builder.add_testarrayoftables(x); }
2176 if let Some(x) = args.testarrayofstring { builder.add_testarrayofstring(x); }
2177 if let Some(x) = args.test4 { builder.add_test4(x); }
2178 if let Some(x) = args.test { builder.add_test(x); }
2179 if let Some(x) = args.inventory { builder.add_inventory(x); }
2180 if let Some(x) = args.name { builder.add_name(x); }
2181 if let Some(x) = args.pos { builder.add_pos(x); }
2182 builder.add_hp(args.hp);
2183 builder.add_mana(args.mana);
2184 builder.add_signed_enum(args.signed_enum);
2185 builder.add_any_ambiguous_type(args.any_ambiguous_type);
2186 builder.add_any_unique_type(args.any_unique_type);
2187 builder.add_testbool(args.testbool);
2188 builder.add_test_type(args.test_type);
2189 builder.add_color(args.color);
2190 builder.finish()
2191 }
2192
unpack(&self) -> MonsterT2193 pub fn unpack(&self) -> MonsterT {
2194 let pos = self.pos().map(|x| {
2195 x.unpack()
2196 });
2197 let mana = self.mana();
2198 let hp = self.hp();
2199 let name = {
2200 let x = self.name();
2201 x.to_string()
2202 };
2203 let inventory = self.inventory().map(|x| {
2204 x.to_vec()
2205 });
2206 let color = self.color();
2207 let test = match self.test_type() {
2208 Any::NONE => AnyT::NONE,
2209 Any::Monster => AnyT::Monster(Box::new(
2210 self.test_as_monster()
2211 .expect("Invalid union table, expected `Any::Monster`.")
2212 .unpack()
2213 )),
2214 Any::TestSimpleTableWithEnum => AnyT::TestSimpleTableWithEnum(Box::new(
2215 self.test_as_test_simple_table_with_enum()
2216 .expect("Invalid union table, expected `Any::TestSimpleTableWithEnum`.")
2217 .unpack()
2218 )),
2219 Any::MyGame_Example2_Monster => AnyT::MyGameExample2Monster(Box::new(
2220 self.test_as_my_game_example_2_monster()
2221 .expect("Invalid union table, expected `Any::MyGame_Example2_Monster`.")
2222 .unpack()
2223 )),
2224 _ => AnyT::NONE,
2225 };
2226 let test4 = self.test4().map(|x| {
2227 x.iter().map(|t| t.unpack()).collect()
2228 });
2229 let testarrayofstring = self.testarrayofstring().map(|x| {
2230 x.iter().map(|s| s.to_string()).collect()
2231 });
2232 let testarrayoftables = self.testarrayoftables().map(|x| {
2233 x.iter().map(|t| t.unpack()).collect()
2234 });
2235 let enemy = self.enemy().map(|x| {
2236 Box::new(x.unpack())
2237 });
2238 let testnestedflatbuffer = self.testnestedflatbuffer().map(|x| {
2239 x.to_vec()
2240 });
2241 let testempty = self.testempty().map(|x| {
2242 Box::new(x.unpack())
2243 });
2244 let testbool = self.testbool();
2245 let testhashs32_fnv1 = self.testhashs32_fnv1();
2246 let testhashu32_fnv1 = self.testhashu32_fnv1();
2247 let testhashs64_fnv1 = self.testhashs64_fnv1();
2248 let testhashu64_fnv1 = self.testhashu64_fnv1();
2249 let testhashs32_fnv1a = self.testhashs32_fnv1a();
2250 let testhashu32_fnv1a = self.testhashu32_fnv1a();
2251 let testhashs64_fnv1a = self.testhashs64_fnv1a();
2252 let testhashu64_fnv1a = self.testhashu64_fnv1a();
2253 let testarrayofbools = self.testarrayofbools().map(|x| {
2254 x.to_vec()
2255 });
2256 let testf = self.testf();
2257 let testf2 = self.testf2();
2258 let testf3 = self.testf3();
2259 let testarrayofstring2 = self.testarrayofstring2().map(|x| {
2260 x.iter().map(|s| s.to_string()).collect()
2261 });
2262 let testarrayofsortedstruct = self.testarrayofsortedstruct().map(|x| {
2263 x.iter().map(|t| t.unpack()).collect()
2264 });
2265 let flex = self.flex().map(|x| {
2266 x.to_vec()
2267 });
2268 let test5 = self.test5().map(|x| {
2269 x.iter().map(|t| t.unpack()).collect()
2270 });
2271 let vector_of_longs = self.vector_of_longs().map(|x| {
2272 x.into_iter().collect()
2273 });
2274 let vector_of_doubles = self.vector_of_doubles().map(|x| {
2275 x.into_iter().collect()
2276 });
2277 let parent_namespace_test = self.parent_namespace_test().map(|x| {
2278 Box::new(x.unpack())
2279 });
2280 let vector_of_referrables = self.vector_of_referrables().map(|x| {
2281 x.iter().map(|t| t.unpack()).collect()
2282 });
2283 let single_weak_reference = self.single_weak_reference();
2284 let vector_of_weak_references = self.vector_of_weak_references().map(|x| {
2285 x.into_iter().collect()
2286 });
2287 let vector_of_strong_referrables = self.vector_of_strong_referrables().map(|x| {
2288 x.iter().map(|t| t.unpack()).collect()
2289 });
2290 let co_owning_reference = self.co_owning_reference();
2291 let vector_of_co_owning_references = self.vector_of_co_owning_references().map(|x| {
2292 x.into_iter().collect()
2293 });
2294 let non_owning_reference = self.non_owning_reference();
2295 let vector_of_non_owning_references = self.vector_of_non_owning_references().map(|x| {
2296 x.into_iter().collect()
2297 });
2298 let any_unique = match self.any_unique_type() {
2299 AnyUniqueAliases::NONE => AnyUniqueAliasesT::NONE,
2300 AnyUniqueAliases::M => AnyUniqueAliasesT::M(Box::new(
2301 self.any_unique_as_m()
2302 .expect("Invalid union table, expected `AnyUniqueAliases::M`.")
2303 .unpack()
2304 )),
2305 AnyUniqueAliases::TS => AnyUniqueAliasesT::TS(Box::new(
2306 self.any_unique_as_ts()
2307 .expect("Invalid union table, expected `AnyUniqueAliases::TS`.")
2308 .unpack()
2309 )),
2310 AnyUniqueAliases::M2 => AnyUniqueAliasesT::M2(Box::new(
2311 self.any_unique_as_m2()
2312 .expect("Invalid union table, expected `AnyUniqueAliases::M2`.")
2313 .unpack()
2314 )),
2315 _ => AnyUniqueAliasesT::NONE,
2316 };
2317 let any_ambiguous = match self.any_ambiguous_type() {
2318 AnyAmbiguousAliases::NONE => AnyAmbiguousAliasesT::NONE,
2319 AnyAmbiguousAliases::M1 => AnyAmbiguousAliasesT::M1(Box::new(
2320 self.any_ambiguous_as_m1()
2321 .expect("Invalid union table, expected `AnyAmbiguousAliases::M1`.")
2322 .unpack()
2323 )),
2324 AnyAmbiguousAliases::M2 => AnyAmbiguousAliasesT::M2(Box::new(
2325 self.any_ambiguous_as_m2()
2326 .expect("Invalid union table, expected `AnyAmbiguousAliases::M2`.")
2327 .unpack()
2328 )),
2329 AnyAmbiguousAliases::M3 => AnyAmbiguousAliasesT::M3(Box::new(
2330 self.any_ambiguous_as_m3()
2331 .expect("Invalid union table, expected `AnyAmbiguousAliases::M3`.")
2332 .unpack()
2333 )),
2334 _ => AnyAmbiguousAliasesT::NONE,
2335 };
2336 let vector_of_enums = self.vector_of_enums().map(|x| {
2337 x.into_iter().collect()
2338 });
2339 let signed_enum = self.signed_enum();
2340 let testrequirednestedflatbuffer = self.testrequirednestedflatbuffer().map(|x| {
2341 x.to_vec()
2342 });
2343 let scalar_key_sorted_tables = self.scalar_key_sorted_tables().map(|x| {
2344 x.iter().map(|t| t.unpack()).collect()
2345 });
2346 MonsterT {
2347 pos,
2348 mana,
2349 hp,
2350 name,
2351 inventory,
2352 color,
2353 test,
2354 test4,
2355 testarrayofstring,
2356 testarrayoftables,
2357 enemy,
2358 testnestedflatbuffer,
2359 testempty,
2360 testbool,
2361 testhashs32_fnv1,
2362 testhashu32_fnv1,
2363 testhashs64_fnv1,
2364 testhashu64_fnv1,
2365 testhashs32_fnv1a,
2366 testhashu32_fnv1a,
2367 testhashs64_fnv1a,
2368 testhashu64_fnv1a,
2369 testarrayofbools,
2370 testf,
2371 testf2,
2372 testf3,
2373 testarrayofstring2,
2374 testarrayofsortedstruct,
2375 flex,
2376 test5,
2377 vector_of_longs,
2378 vector_of_doubles,
2379 parent_namespace_test,
2380 vector_of_referrables,
2381 single_weak_reference,
2382 vector_of_weak_references,
2383 vector_of_strong_referrables,
2384 co_owning_reference,
2385 vector_of_co_owning_references,
2386 non_owning_reference,
2387 vector_of_non_owning_references,
2388 any_unique,
2389 any_ambiguous,
2390 vector_of_enums,
2391 signed_enum,
2392 testrequirednestedflatbuffer,
2393 scalar_key_sorted_tables,
2394 }
2395 }
2396 pub const VT_POS: flatbuffers::VOffsetT = 4;
2397 pub const VT_MANA: flatbuffers::VOffsetT = 6;
2398 pub const VT_HP: flatbuffers::VOffsetT = 8;
2399 pub const VT_NAME: flatbuffers::VOffsetT = 10;
2400 pub const VT_INVENTORY: flatbuffers::VOffsetT = 14;
2401 pub const VT_COLOR: flatbuffers::VOffsetT = 16;
2402 pub const VT_TEST_TYPE: flatbuffers::VOffsetT = 18;
2403 pub const VT_TEST: flatbuffers::VOffsetT = 20;
2404 pub const VT_TEST4: flatbuffers::VOffsetT = 22;
2405 pub const VT_TESTARRAYOFSTRING: flatbuffers::VOffsetT = 24;
2406 pub const VT_TESTARRAYOFTABLES: flatbuffers::VOffsetT = 26;
2407 pub const VT_ENEMY: flatbuffers::VOffsetT = 28;
2408 pub const VT_TESTNESTEDFLATBUFFER: flatbuffers::VOffsetT = 30;
2409 pub const VT_TESTEMPTY: flatbuffers::VOffsetT = 32;
2410 pub const VT_TESTBOOL: flatbuffers::VOffsetT = 34;
2411 pub const VT_TESTHASHS32_FNV1: flatbuffers::VOffsetT = 36;
2412 pub const VT_TESTHASHU32_FNV1: flatbuffers::VOffsetT = 38;
2413 pub const VT_TESTHASHS64_FNV1: flatbuffers::VOffsetT = 40;
2414 pub const VT_TESTHASHU64_FNV1: flatbuffers::VOffsetT = 42;
2415 pub const VT_TESTHASHS32_FNV1A: flatbuffers::VOffsetT = 44;
2416 pub const VT_TESTHASHU32_FNV1A: flatbuffers::VOffsetT = 46;
2417 pub const VT_TESTHASHS64_FNV1A: flatbuffers::VOffsetT = 48;
2418 pub const VT_TESTHASHU64_FNV1A: flatbuffers::VOffsetT = 50;
2419 pub const VT_TESTARRAYOFBOOLS: flatbuffers::VOffsetT = 52;
2420 pub const VT_TESTF: flatbuffers::VOffsetT = 54;
2421 pub const VT_TESTF2: flatbuffers::VOffsetT = 56;
2422 pub const VT_TESTF3: flatbuffers::VOffsetT = 58;
2423 pub const VT_TESTARRAYOFSTRING2: flatbuffers::VOffsetT = 60;
2424 pub const VT_TESTARRAYOFSORTEDSTRUCT: flatbuffers::VOffsetT = 62;
2425 pub const VT_FLEX: flatbuffers::VOffsetT = 64;
2426 pub const VT_TEST5: flatbuffers::VOffsetT = 66;
2427 pub const VT_VECTOR_OF_LONGS: flatbuffers::VOffsetT = 68;
2428 pub const VT_VECTOR_OF_DOUBLES: flatbuffers::VOffsetT = 70;
2429 pub const VT_PARENT_NAMESPACE_TEST: flatbuffers::VOffsetT = 72;
2430 pub const VT_VECTOR_OF_REFERRABLES: flatbuffers::VOffsetT = 74;
2431 pub const VT_SINGLE_WEAK_REFERENCE: flatbuffers::VOffsetT = 76;
2432 pub const VT_VECTOR_OF_WEAK_REFERENCES: flatbuffers::VOffsetT = 78;
2433 pub const VT_VECTOR_OF_STRONG_REFERRABLES: flatbuffers::VOffsetT = 80;
2434 pub const VT_CO_OWNING_REFERENCE: flatbuffers::VOffsetT = 82;
2435 pub const VT_VECTOR_OF_CO_OWNING_REFERENCES: flatbuffers::VOffsetT = 84;
2436 pub const VT_NON_OWNING_REFERENCE: flatbuffers::VOffsetT = 86;
2437 pub const VT_VECTOR_OF_NON_OWNING_REFERENCES: flatbuffers::VOffsetT = 88;
2438 pub const VT_ANY_UNIQUE_TYPE: flatbuffers::VOffsetT = 90;
2439 pub const VT_ANY_UNIQUE: flatbuffers::VOffsetT = 92;
2440 pub const VT_ANY_AMBIGUOUS_TYPE: flatbuffers::VOffsetT = 94;
2441 pub const VT_ANY_AMBIGUOUS: flatbuffers::VOffsetT = 96;
2442 pub const VT_VECTOR_OF_ENUMS: flatbuffers::VOffsetT = 98;
2443 pub const VT_SIGNED_ENUM: flatbuffers::VOffsetT = 100;
2444 pub const VT_TESTREQUIREDNESTEDFLATBUFFER: flatbuffers::VOffsetT = 102;
2445 pub const VT_SCALAR_KEY_SORTED_TABLES: flatbuffers::VOffsetT = 104;
2446
2447 #[inline]
pos(&self) -> Option<&'a Vec3>2448 pub fn pos(&self) -> Option<&'a Vec3> {
2449 self._tab.get::<Vec3>(Monster::VT_POS, None)
2450 }
2451 #[inline]
mana(&self) -> i162452 pub fn mana(&self) -> i16 {
2453 self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()
2454 }
2455 #[inline]
hp(&self) -> i162456 pub fn hp(&self) -> i16 {
2457 self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()
2458 }
2459 #[inline]
name(&self) -> &'a str2460 pub fn name(&self) -> &'a str {
2461 self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()
2462 }
2463 #[inline]
key_compare_less_than(&self, o: &Monster) -> bool2464 pub fn key_compare_less_than(&self, o: &Monster) -> bool {
2465 self.name() < o.name()
2466 }
2467
2468 #[inline]
key_compare_with_value(&self, val: & str) -> ::std::cmp::Ordering2469 pub fn key_compare_with_value(&self, val: & str) -> ::std::cmp::Ordering {
2470 let key = self.name();
2471 key.cmp(&val)
2472 }
2473 #[inline]
inventory(&self) -> Option<&'a [u8]>2474 pub fn inventory(&self) -> Option<&'a [u8]> {
2475 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None).map(|v| v.safe_slice())
2476 }
2477 #[inline]
color(&self) -> Color2478 pub fn color(&self) -> Color {
2479 self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()
2480 }
2481 #[inline]
test_type(&self) -> Any2482 pub fn test_type(&self) -> Any {
2483 self._tab.get::<Any>(Monster::VT_TEST_TYPE, Some(Any::NONE)).unwrap()
2484 }
2485 #[inline]
test(&self) -> Option<flatbuffers::Table<'a>>2486 pub fn test(&self) -> Option<flatbuffers::Table<'a>> {
2487 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_TEST, None)
2488 }
2489 #[inline]
test4(&self) -> Option<&'a [Test]>2490 pub fn test4(&self) -> Option<&'a [Test]> {
2491 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST4, None).map(|v| v.safe_slice())
2492 }
2493 #[inline]
testarrayofstring(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>2494 pub fn testarrayofstring(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
2495 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING, None)
2496 }
2497 /// an example documentation comment: this will end up in the generated code
2498 /// multiline too
2499 #[inline]
testarrayoftables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>>2500 pub fn testarrayoftables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>> {
2501 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster>>>>(Monster::VT_TESTARRAYOFTABLES, None)
2502 }
2503 #[inline]
enemy(&self) -> Option<Monster<'a>>2504 pub fn enemy(&self) -> Option<Monster<'a>> {
2505 self._tab.get::<flatbuffers::ForwardsUOffset<Monster>>(Monster::VT_ENEMY, None)
2506 }
2507 #[inline]
testnestedflatbuffer(&self) -> Option<&'a [u8]>2508 pub fn testnestedflatbuffer(&self) -> Option<&'a [u8]> {
2509 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
2510 }
testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>>2511 pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
2512 self.testnestedflatbuffer().map(|data| {
2513 use flatbuffers::Follow;
2514 <flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0)
2515 })
2516 }
2517 #[inline]
testempty(&self) -> Option<Stat<'a>>2518 pub fn testempty(&self) -> Option<Stat<'a>> {
2519 self._tab.get::<flatbuffers::ForwardsUOffset<Stat>>(Monster::VT_TESTEMPTY, None)
2520 }
2521 #[inline]
testbool(&self) -> bool2522 pub fn testbool(&self) -> bool {
2523 self._tab.get::<bool>(Monster::VT_TESTBOOL, Some(false)).unwrap()
2524 }
2525 #[inline]
testhashs32_fnv1(&self) -> i322526 pub fn testhashs32_fnv1(&self) -> i32 {
2527 self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1, Some(0)).unwrap()
2528 }
2529 #[inline]
testhashu32_fnv1(&self) -> u322530 pub fn testhashu32_fnv1(&self) -> u32 {
2531 self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1, Some(0)).unwrap()
2532 }
2533 #[inline]
testhashs64_fnv1(&self) -> i642534 pub fn testhashs64_fnv1(&self) -> i64 {
2535 self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1, Some(0)).unwrap()
2536 }
2537 #[inline]
testhashu64_fnv1(&self) -> u642538 pub fn testhashu64_fnv1(&self) -> u64 {
2539 self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1, Some(0)).unwrap()
2540 }
2541 #[inline]
testhashs32_fnv1a(&self) -> i322542 pub fn testhashs32_fnv1a(&self) -> i32 {
2543 self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1A, Some(0)).unwrap()
2544 }
2545 #[inline]
testhashu32_fnv1a(&self) -> u322546 pub fn testhashu32_fnv1a(&self) -> u32 {
2547 self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1A, Some(0)).unwrap()
2548 }
2549 #[inline]
testhashs64_fnv1a(&self) -> i642550 pub fn testhashs64_fnv1a(&self) -> i64 {
2551 self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1A, Some(0)).unwrap()
2552 }
2553 #[inline]
testhashu64_fnv1a(&self) -> u642554 pub fn testhashu64_fnv1a(&self) -> u64 {
2555 self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1A, Some(0)).unwrap()
2556 }
2557 #[inline]
testarrayofbools(&self) -> Option<&'a [bool]>2558 pub fn testarrayofbools(&self) -> Option<&'a [bool]> {
2559 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, bool>>>(Monster::VT_TESTARRAYOFBOOLS, None).map(|v| v.safe_slice())
2560 }
2561 #[inline]
testf(&self) -> f322562 pub fn testf(&self) -> f32 {
2563 self._tab.get::<f32>(Monster::VT_TESTF, Some(3.14159)).unwrap()
2564 }
2565 #[inline]
testf2(&self) -> f322566 pub fn testf2(&self) -> f32 {
2567 self._tab.get::<f32>(Monster::VT_TESTF2, Some(3.0)).unwrap()
2568 }
2569 #[inline]
testf3(&self) -> f322570 pub fn testf3(&self) -> f32 {
2571 self._tab.get::<f32>(Monster::VT_TESTF3, Some(0.0)).unwrap()
2572 }
2573 #[inline]
testarrayofstring2(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>2574 pub fn testarrayofstring2(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
2575 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING2, None)
2576 }
2577 #[inline]
testarrayofsortedstruct(&self) -> Option<&'a [Ability]>2578 pub fn testarrayofsortedstruct(&self) -> Option<&'a [Ability]> {
2579 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Ability>>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, None).map(|v| v.safe_slice())
2580 }
2581 #[inline]
flex(&self) -> Option<&'a [u8]>2582 pub fn flex(&self) -> Option<&'a [u8]> {
2583 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_FLEX, None).map(|v| v.safe_slice())
2584 }
2585 #[inline]
test5(&self) -> Option<&'a [Test]>2586 pub fn test5(&self) -> Option<&'a [Test]> {
2587 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST5, None).map(|v| v.safe_slice())
2588 }
2589 #[inline]
vector_of_longs(&self) -> Option<flatbuffers::Vector<'a, i64>>2590 pub fn vector_of_longs(&self) -> Option<flatbuffers::Vector<'a, i64>> {
2591 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i64>>>(Monster::VT_VECTOR_OF_LONGS, None)
2592 }
2593 #[inline]
vector_of_doubles(&self) -> Option<flatbuffers::Vector<'a, f64>>2594 pub fn vector_of_doubles(&self) -> Option<flatbuffers::Vector<'a, f64>> {
2595 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Monster::VT_VECTOR_OF_DOUBLES, None)
2596 }
2597 #[inline]
parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>>2598 pub fn parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>> {
2599 self._tab.get::<flatbuffers::ForwardsUOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, None)
2600 }
2601 #[inline]
vector_of_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>2602 pub fn vector_of_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
2603 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None)
2604 }
2605 #[inline]
single_weak_reference(&self) -> u642606 pub fn single_weak_reference(&self) -> u64 {
2607 self._tab.get::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, Some(0)).unwrap()
2608 }
2609 #[inline]
vector_of_weak_references(&self) -> Option<flatbuffers::Vector<'a, u64>>2610 pub fn vector_of_weak_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
2611 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None)
2612 }
2613 #[inline]
vector_of_strong_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>2614 pub fn vector_of_strong_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
2615 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None)
2616 }
2617 #[inline]
co_owning_reference(&self) -> u642618 pub fn co_owning_reference(&self) -> u64 {
2619 self._tab.get::<u64>(Monster::VT_CO_OWNING_REFERENCE, Some(0)).unwrap()
2620 }
2621 #[inline]
vector_of_co_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>>2622 pub fn vector_of_co_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
2623 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, None)
2624 }
2625 #[inline]
non_owning_reference(&self) -> u642626 pub fn non_owning_reference(&self) -> u64 {
2627 self._tab.get::<u64>(Monster::VT_NON_OWNING_REFERENCE, Some(0)).unwrap()
2628 }
2629 #[inline]
vector_of_non_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>>2630 pub fn vector_of_non_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
2631 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)
2632 }
2633 #[inline]
any_unique_type(&self) -> AnyUniqueAliases2634 pub fn any_unique_type(&self) -> AnyUniqueAliases {
2635 self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()
2636 }
2637 #[inline]
any_unique(&self) -> Option<flatbuffers::Table<'a>>2638 pub fn any_unique(&self) -> Option<flatbuffers::Table<'a>> {
2639 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)
2640 }
2641 #[inline]
any_ambiguous_type(&self) -> AnyAmbiguousAliases2642 pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases {
2643 self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()
2644 }
2645 #[inline]
any_ambiguous(&self) -> Option<flatbuffers::Table<'a>>2646 pub fn any_ambiguous(&self) -> Option<flatbuffers::Table<'a>> {
2647 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)
2648 }
2649 #[inline]
vector_of_enums(&self) -> Option<flatbuffers::Vector<'a, Color>>2650 pub fn vector_of_enums(&self) -> Option<flatbuffers::Vector<'a, Color>> {
2651 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)
2652 }
2653 #[inline]
signed_enum(&self) -> Race2654 pub fn signed_enum(&self) -> Race {
2655 self._tab.get::<Race>(Monster::VT_SIGNED_ENUM, Some(Race::None)).unwrap()
2656 }
2657 #[inline]
testrequirednestedflatbuffer(&self) -> Option<&'a [u8]>2658 pub fn testrequirednestedflatbuffer(&self) -> Option<&'a [u8]> {
2659 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
2660 }
testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>>2661 pub fn testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
2662 self.testrequirednestedflatbuffer().map(|data| {
2663 use flatbuffers::Follow;
2664 <flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0)
2665 })
2666 }
2667 #[inline]
scalar_key_sorted_tables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat<'a>>>>2668 pub fn scalar_key_sorted_tables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat<'a>>>> {
2669 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat>>>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, None)
2670 }
2671 #[inline]
2672 #[allow(non_snake_case)]
test_as_monster(&self) -> Option<Monster<'a>>2673 pub fn test_as_monster(&self) -> Option<Monster<'a>> {
2674 if self.test_type() == Any::Monster {
2675 self.test().map(Monster::init_from_table)
2676 } else {
2677 None
2678 }
2679 }
2680
2681 #[inline]
2682 #[allow(non_snake_case)]
test_as_test_simple_table_with_enum(&self) -> Option<TestSimpleTableWithEnum<'a>>2683 pub fn test_as_test_simple_table_with_enum(&self) -> Option<TestSimpleTableWithEnum<'a>> {
2684 if self.test_type() == Any::TestSimpleTableWithEnum {
2685 self.test().map(TestSimpleTableWithEnum::init_from_table)
2686 } else {
2687 None
2688 }
2689 }
2690
2691 #[inline]
2692 #[allow(non_snake_case)]
test_as_my_game_example_2_monster(&self) -> Option<super::example_2::Monster<'a>>2693 pub fn test_as_my_game_example_2_monster(&self) -> Option<super::example_2::Monster<'a>> {
2694 if self.test_type() == Any::MyGame_Example2_Monster {
2695 self.test().map(super::example_2::Monster::init_from_table)
2696 } else {
2697 None
2698 }
2699 }
2700
2701 #[inline]
2702 #[allow(non_snake_case)]
any_unique_as_m(&self) -> Option<Monster<'a>>2703 pub fn any_unique_as_m(&self) -> Option<Monster<'a>> {
2704 if self.any_unique_type() == AnyUniqueAliases::M {
2705 self.any_unique().map(Monster::init_from_table)
2706 } else {
2707 None
2708 }
2709 }
2710
2711 #[inline]
2712 #[allow(non_snake_case)]
any_unique_as_ts(&self) -> Option<TestSimpleTableWithEnum<'a>>2713 pub fn any_unique_as_ts(&self) -> Option<TestSimpleTableWithEnum<'a>> {
2714 if self.any_unique_type() == AnyUniqueAliases::TS {
2715 self.any_unique().map(TestSimpleTableWithEnum::init_from_table)
2716 } else {
2717 None
2718 }
2719 }
2720
2721 #[inline]
2722 #[allow(non_snake_case)]
any_unique_as_m2(&self) -> Option<super::example_2::Monster<'a>>2723 pub fn any_unique_as_m2(&self) -> Option<super::example_2::Monster<'a>> {
2724 if self.any_unique_type() == AnyUniqueAliases::M2 {
2725 self.any_unique().map(super::example_2::Monster::init_from_table)
2726 } else {
2727 None
2728 }
2729 }
2730
2731 #[inline]
2732 #[allow(non_snake_case)]
any_ambiguous_as_m1(&self) -> Option<Monster<'a>>2733 pub fn any_ambiguous_as_m1(&self) -> Option<Monster<'a>> {
2734 if self.any_ambiguous_type() == AnyAmbiguousAliases::M1 {
2735 self.any_ambiguous().map(Monster::init_from_table)
2736 } else {
2737 None
2738 }
2739 }
2740
2741 #[inline]
2742 #[allow(non_snake_case)]
any_ambiguous_as_m2(&self) -> Option<Monster<'a>>2743 pub fn any_ambiguous_as_m2(&self) -> Option<Monster<'a>> {
2744 if self.any_ambiguous_type() == AnyAmbiguousAliases::M2 {
2745 self.any_ambiguous().map(Monster::init_from_table)
2746 } else {
2747 None
2748 }
2749 }
2750
2751 #[inline]
2752 #[allow(non_snake_case)]
any_ambiguous_as_m3(&self) -> Option<Monster<'a>>2753 pub fn any_ambiguous_as_m3(&self) -> Option<Monster<'a>> {
2754 if self.any_ambiguous_type() == AnyAmbiguousAliases::M3 {
2755 self.any_ambiguous().map(Monster::init_from_table)
2756 } else {
2757 None
2758 }
2759 }
2760
2761 }
2762
2763 impl flatbuffers::Verifiable for Monster<'_> {
2764 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>2765 fn run_verifier(
2766 v: &mut flatbuffers::Verifier, pos: usize
2767 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
2768 use self::flatbuffers::Verifiable;
2769 v.visit_table(pos)?
2770 .visit_field::<Vec3>(&"pos", Self::VT_POS, false)?
2771 .visit_field::<i16>(&"mana", Self::VT_MANA, false)?
2772 .visit_field::<i16>(&"hp", Self::VT_HP, false)?
2773 .visit_field::<flatbuffers::ForwardsUOffset<&str>>(&"name", Self::VT_NAME, true)?
2774 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>(&"inventory", Self::VT_INVENTORY, false)?
2775 .visit_field::<Color>(&"color", Self::VT_COLOR, false)?
2776 .visit_union::<Any, _>(&"test_type", Self::VT_TEST_TYPE, &"test", Self::VT_TEST, false, |key, v, pos| {
2777 match key {
2778 Any::Monster => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("Any::Monster", pos),
2779 Any::TestSimpleTableWithEnum => v.verify_union_variant::<flatbuffers::ForwardsUOffset<TestSimpleTableWithEnum>>("Any::TestSimpleTableWithEnum", pos),
2780 Any::MyGame_Example2_Monster => v.verify_union_variant::<flatbuffers::ForwardsUOffset<super::example_2::Monster>>("Any::MyGame_Example2_Monster", pos),
2781 _ => Ok(()),
2782 }
2783 })?
2784 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Test>>>(&"test4", Self::VT_TEST4, false)?
2785 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>>>(&"testarrayofstring", Self::VT_TESTARRAYOFSTRING, false)?
2786 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Monster>>>>(&"testarrayoftables", Self::VT_TESTARRAYOFTABLES, false)?
2787 .visit_field::<flatbuffers::ForwardsUOffset<Monster>>(&"enemy", Self::VT_ENEMY, false)?
2788 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>(&"testnestedflatbuffer", Self::VT_TESTNESTEDFLATBUFFER, false)?
2789 .visit_field::<flatbuffers::ForwardsUOffset<Stat>>(&"testempty", Self::VT_TESTEMPTY, false)?
2790 .visit_field::<bool>(&"testbool", Self::VT_TESTBOOL, false)?
2791 .visit_field::<i32>(&"testhashs32_fnv1", Self::VT_TESTHASHS32_FNV1, false)?
2792 .visit_field::<u32>(&"testhashu32_fnv1", Self::VT_TESTHASHU32_FNV1, false)?
2793 .visit_field::<i64>(&"testhashs64_fnv1", Self::VT_TESTHASHS64_FNV1, false)?
2794 .visit_field::<u64>(&"testhashu64_fnv1", Self::VT_TESTHASHU64_FNV1, false)?
2795 .visit_field::<i32>(&"testhashs32_fnv1a", Self::VT_TESTHASHS32_FNV1A, false)?
2796 .visit_field::<u32>(&"testhashu32_fnv1a", Self::VT_TESTHASHU32_FNV1A, false)?
2797 .visit_field::<i64>(&"testhashs64_fnv1a", Self::VT_TESTHASHS64_FNV1A, false)?
2798 .visit_field::<u64>(&"testhashu64_fnv1a", Self::VT_TESTHASHU64_FNV1A, false)?
2799 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, bool>>>(&"testarrayofbools", Self::VT_TESTARRAYOFBOOLS, false)?
2800 .visit_field::<f32>(&"testf", Self::VT_TESTF, false)?
2801 .visit_field::<f32>(&"testf2", Self::VT_TESTF2, false)?
2802 .visit_field::<f32>(&"testf3", Self::VT_TESTF3, false)?
2803 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>>>(&"testarrayofstring2", Self::VT_TESTARRAYOFSTRING2, false)?
2804 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Ability>>>(&"testarrayofsortedstruct", Self::VT_TESTARRAYOFSORTEDSTRUCT, false)?
2805 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>(&"flex", Self::VT_FLEX, false)?
2806 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Test>>>(&"test5", Self::VT_TEST5, false)?
2807 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i64>>>(&"vector_of_longs", Self::VT_VECTOR_OF_LONGS, false)?
2808 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>(&"vector_of_doubles", Self::VT_VECTOR_OF_DOUBLES, false)?
2809 .visit_field::<flatbuffers::ForwardsUOffset<super::InParentNamespace>>(&"parent_namespace_test", Self::VT_PARENT_NAMESPACE_TEST, false)?
2810 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Referrable>>>>(&"vector_of_referrables", Self::VT_VECTOR_OF_REFERRABLES, false)?
2811 .visit_field::<u64>(&"single_weak_reference", Self::VT_SINGLE_WEAK_REFERENCE, false)?
2812 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>(&"vector_of_weak_references", Self::VT_VECTOR_OF_WEAK_REFERENCES, false)?
2813 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Referrable>>>>(&"vector_of_strong_referrables", Self::VT_VECTOR_OF_STRONG_REFERRABLES, false)?
2814 .visit_field::<u64>(&"co_owning_reference", Self::VT_CO_OWNING_REFERENCE, false)?
2815 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>(&"vector_of_co_owning_references", Self::VT_VECTOR_OF_CO_OWNING_REFERENCES, false)?
2816 .visit_field::<u64>(&"non_owning_reference", Self::VT_NON_OWNING_REFERENCE, false)?
2817 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>(&"vector_of_non_owning_references", Self::VT_VECTOR_OF_NON_OWNING_REFERENCES, false)?
2818 .visit_union::<AnyUniqueAliases, _>(&"any_unique_type", Self::VT_ANY_UNIQUE_TYPE, &"any_unique", Self::VT_ANY_UNIQUE, false, |key, v, pos| {
2819 match key {
2820 AnyUniqueAliases::M => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyUniqueAliases::M", pos),
2821 AnyUniqueAliases::TS => v.verify_union_variant::<flatbuffers::ForwardsUOffset<TestSimpleTableWithEnum>>("AnyUniqueAliases::TS", pos),
2822 AnyUniqueAliases::M2 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<super::example_2::Monster>>("AnyUniqueAliases::M2", pos),
2823 _ => Ok(()),
2824 }
2825 })?
2826 .visit_union::<AnyAmbiguousAliases, _>(&"any_ambiguous_type", Self::VT_ANY_AMBIGUOUS_TYPE, &"any_ambiguous", Self::VT_ANY_AMBIGUOUS, false, |key, v, pos| {
2827 match key {
2828 AnyAmbiguousAliases::M1 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyAmbiguousAliases::M1", pos),
2829 AnyAmbiguousAliases::M2 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyAmbiguousAliases::M2", pos),
2830 AnyAmbiguousAliases::M3 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyAmbiguousAliases::M3", pos),
2831 _ => Ok(()),
2832 }
2833 })?
2834 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Color>>>(&"vector_of_enums", Self::VT_VECTOR_OF_ENUMS, false)?
2835 .visit_field::<Race>(&"signed_enum", Self::VT_SIGNED_ENUM, false)?
2836 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>(&"testrequirednestedflatbuffer", Self::VT_TESTREQUIREDNESTEDFLATBUFFER, false)?
2837 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Stat>>>>(&"scalar_key_sorted_tables", Self::VT_SCALAR_KEY_SORTED_TABLES, false)?
2838 .finish();
2839 Ok(())
2840 }
2841 }
2842 pub struct MonsterArgs<'a> {
2843 pub pos: Option<&'a Vec3>,
2844 pub mana: i16,
2845 pub hp: i16,
2846 pub name: Option<flatbuffers::WIPOffset<&'a str>>,
2847 pub inventory: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
2848 pub color: Color,
2849 pub test_type: Any,
2850 pub test: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
2851 pub test4: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Test>>>,
2852 pub testarrayofstring: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
2853 pub testarrayoftables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>>>,
2854 pub enemy: Option<flatbuffers::WIPOffset<Monster<'a>>>,
2855 pub testnestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
2856 pub testempty: Option<flatbuffers::WIPOffset<Stat<'a>>>,
2857 pub testbool: bool,
2858 pub testhashs32_fnv1: i32,
2859 pub testhashu32_fnv1: u32,
2860 pub testhashs64_fnv1: i64,
2861 pub testhashu64_fnv1: u64,
2862 pub testhashs32_fnv1a: i32,
2863 pub testhashu32_fnv1a: u32,
2864 pub testhashs64_fnv1a: i64,
2865 pub testhashu64_fnv1a: u64,
2866 pub testarrayofbools: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, bool>>>,
2867 pub testf: f32,
2868 pub testf2: f32,
2869 pub testf3: f32,
2870 pub testarrayofstring2: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
2871 pub testarrayofsortedstruct: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Ability>>>,
2872 pub flex: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
2873 pub test5: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Test>>>,
2874 pub vector_of_longs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i64>>>,
2875 pub vector_of_doubles: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
2876 pub parent_namespace_test: Option<flatbuffers::WIPOffset<super::InParentNamespace<'a>>>,
2877 pub vector_of_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>>,
2878 pub single_weak_reference: u64,
2879 pub vector_of_weak_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
2880 pub vector_of_strong_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>>,
2881 pub co_owning_reference: u64,
2882 pub vector_of_co_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
2883 pub non_owning_reference: u64,
2884 pub vector_of_non_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
2885 pub any_unique_type: AnyUniqueAliases,
2886 pub any_unique: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
2887 pub any_ambiguous_type: AnyAmbiguousAliases,
2888 pub any_ambiguous: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
2889 pub vector_of_enums: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Color>>>,
2890 pub signed_enum: Race,
2891 pub testrequirednestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
2892 pub scalar_key_sorted_tables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat<'a>>>>>,
2893 }
2894 impl<'a> Default for MonsterArgs<'a> {
2895 #[inline]
default() -> Self2896 fn default() -> Self {
2897 MonsterArgs {
2898 pos: None,
2899 mana: 150,
2900 hp: 100,
2901 name: None, // required field
2902 inventory: None,
2903 color: Color::Blue,
2904 test_type: Any::NONE,
2905 test: None,
2906 test4: None,
2907 testarrayofstring: None,
2908 testarrayoftables: None,
2909 enemy: None,
2910 testnestedflatbuffer: None,
2911 testempty: None,
2912 testbool: false,
2913 testhashs32_fnv1: 0,
2914 testhashu32_fnv1: 0,
2915 testhashs64_fnv1: 0,
2916 testhashu64_fnv1: 0,
2917 testhashs32_fnv1a: 0,
2918 testhashu32_fnv1a: 0,
2919 testhashs64_fnv1a: 0,
2920 testhashu64_fnv1a: 0,
2921 testarrayofbools: None,
2922 testf: 3.14159,
2923 testf2: 3.0,
2924 testf3: 0.0,
2925 testarrayofstring2: None,
2926 testarrayofsortedstruct: None,
2927 flex: None,
2928 test5: None,
2929 vector_of_longs: None,
2930 vector_of_doubles: None,
2931 parent_namespace_test: None,
2932 vector_of_referrables: None,
2933 single_weak_reference: 0,
2934 vector_of_weak_references: None,
2935 vector_of_strong_referrables: None,
2936 co_owning_reference: 0,
2937 vector_of_co_owning_references: None,
2938 non_owning_reference: 0,
2939 vector_of_non_owning_references: None,
2940 any_unique_type: AnyUniqueAliases::NONE,
2941 any_unique: None,
2942 any_ambiguous_type: AnyAmbiguousAliases::NONE,
2943 any_ambiguous: None,
2944 vector_of_enums: None,
2945 signed_enum: Race::None,
2946 testrequirednestedflatbuffer: None,
2947 scalar_key_sorted_tables: None,
2948 }
2949 }
2950 }
2951 pub struct MonsterBuilder<'a: 'b, 'b> {
2952 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
2953 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
2954 }
2955 impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
2956 #[inline]
add_pos(&mut self, pos: &Vec3)2957 pub fn add_pos(&mut self, pos: &Vec3) {
2958 self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
2959 }
2960 #[inline]
add_mana(&mut self, mana: i16)2961 pub fn add_mana(&mut self, mana: i16) {
2962 self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150);
2963 }
2964 #[inline]
add_hp(&mut self, hp: i16)2965 pub fn add_hp(&mut self, hp: i16) {
2966 self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
2967 }
2968 #[inline]
add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>)2969 pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
2970 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
2971 }
2972 #[inline]
add_inventory(&mut self, inventory: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)2973 pub fn add_inventory(&mut self, inventory: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
2974 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
2975 }
2976 #[inline]
add_color(&mut self, color: Color)2977 pub fn add_color(&mut self, color: Color) {
2978 self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
2979 }
2980 #[inline]
add_test_type(&mut self, test_type: Any)2981 pub fn add_test_type(&mut self, test_type: Any) {
2982 self.fbb_.push_slot::<Any>(Monster::VT_TEST_TYPE, test_type, Any::NONE);
2983 }
2984 #[inline]
add_test(&mut self, test: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>)2985 pub fn add_test(&mut self, test: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
2986 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST, test);
2987 }
2988 #[inline]
add_test4(&mut self, test4: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>)2989 pub fn add_test4(&mut self, test4: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>) {
2990 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST4, test4);
2991 }
2992 #[inline]
add_testarrayofstring(&mut self, testarrayofstring: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>)2993 pub fn add_testarrayofstring(&mut self, testarrayofstring: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
2994 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
2995 }
2996 #[inline]
add_testarrayoftables(&mut self, testarrayoftables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Monster<'b >>>>)2997 pub fn add_testarrayoftables(&mut self, testarrayoftables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Monster<'b >>>>) {
2998 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
2999 }
3000 #[inline]
add_enemy(&mut self, enemy: flatbuffers::WIPOffset<Monster<'b >>)3001 pub fn add_enemy(&mut self, enemy: flatbuffers::WIPOffset<Monster<'b >>) {
3002 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Monster>>(Monster::VT_ENEMY, enemy);
3003 }
3004 #[inline]
add_testnestedflatbuffer(&mut self, testnestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)3005 pub fn add_testnestedflatbuffer(&mut self, testnestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
3006 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
3007 }
3008 #[inline]
add_testempty(&mut self, testempty: flatbuffers::WIPOffset<Stat<'b >>)3009 pub fn add_testempty(&mut self, testempty: flatbuffers::WIPOffset<Stat<'b >>) {
3010 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Stat>>(Monster::VT_TESTEMPTY, testempty);
3011 }
3012 #[inline]
add_testbool(&mut self, testbool: bool)3013 pub fn add_testbool(&mut self, testbool: bool) {
3014 self.fbb_.push_slot::<bool>(Monster::VT_TESTBOOL, testbool, false);
3015 }
3016 #[inline]
add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32)3017 pub fn add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32) {
3018 self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
3019 }
3020 #[inline]
add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32)3021 pub fn add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32) {
3022 self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
3023 }
3024 #[inline]
add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64)3025 pub fn add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64) {
3026 self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
3027 }
3028 #[inline]
add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64)3029 pub fn add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64) {
3030 self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
3031 }
3032 #[inline]
add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32)3033 pub fn add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32) {
3034 self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
3035 }
3036 #[inline]
add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32)3037 pub fn add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32) {
3038 self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
3039 }
3040 #[inline]
add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64)3041 pub fn add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64) {
3042 self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
3043 }
3044 #[inline]
add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64)3045 pub fn add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64) {
3046 self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
3047 }
3048 #[inline]
add_testarrayofbools(&mut self, testarrayofbools: flatbuffers::WIPOffset<flatbuffers::Vector<'b , bool>>)3049 pub fn add_testarrayofbools(&mut self, testarrayofbools: flatbuffers::WIPOffset<flatbuffers::Vector<'b , bool>>) {
3050 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
3051 }
3052 #[inline]
add_testf(&mut self, testf: f32)3053 pub fn add_testf(&mut self, testf: f32) {
3054 self.fbb_.push_slot::<f32>(Monster::VT_TESTF, testf, 3.14159);
3055 }
3056 #[inline]
add_testf2(&mut self, testf2: f32)3057 pub fn add_testf2(&mut self, testf2: f32) {
3058 self.fbb_.push_slot::<f32>(Monster::VT_TESTF2, testf2, 3.0);
3059 }
3060 #[inline]
add_testf3(&mut self, testf3: f32)3061 pub fn add_testf3(&mut self, testf3: f32) {
3062 self.fbb_.push_slot::<f32>(Monster::VT_TESTF3, testf3, 0.0);
3063 }
3064 #[inline]
add_testarrayofstring2(&mut self, testarrayofstring2: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>)3065 pub fn add_testarrayofstring2(&mut self, testarrayofstring2: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
3066 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
3067 }
3068 #[inline]
add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Ability>>)3069 pub fn add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Ability>>) {
3070 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
3071 }
3072 #[inline]
add_flex(&mut self, flex: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)3073 pub fn add_flex(&mut self, flex: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
3074 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_FLEX, flex);
3075 }
3076 #[inline]
add_test5(&mut self, test5: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>)3077 pub fn add_test5(&mut self, test5: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>) {
3078 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST5, test5);
3079 }
3080 #[inline]
add_vector_of_longs(&mut self, vector_of_longs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i64>>)3081 pub fn add_vector_of_longs(&mut self, vector_of_longs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i64>>) {
3082 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
3083 }
3084 #[inline]
add_vector_of_doubles(&mut self, vector_of_doubles: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>)3085 pub fn add_vector_of_doubles(&mut self, vector_of_doubles: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
3086 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
3087 }
3088 #[inline]
add_parent_namespace_test(&mut self, parent_namespace_test: flatbuffers::WIPOffset<super::InParentNamespace<'b >>)3089 pub fn add_parent_namespace_test(&mut self, parent_namespace_test: flatbuffers::WIPOffset<super::InParentNamespace<'b >>) {
3090 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
3091 }
3092 #[inline]
add_vector_of_referrables(&mut self, vector_of_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>)3093 pub fn add_vector_of_referrables(&mut self, vector_of_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
3094 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
3095 }
3096 #[inline]
add_single_weak_reference(&mut self, single_weak_reference: u64)3097 pub fn add_single_weak_reference(&mut self, single_weak_reference: u64) {
3098 self.fbb_.push_slot::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
3099 }
3100 #[inline]
add_vector_of_weak_references(&mut self, vector_of_weak_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>)3101 pub fn add_vector_of_weak_references(&mut self, vector_of_weak_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
3102 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
3103 }
3104 #[inline]
add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>)3105 pub fn add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
3106 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
3107 }
3108 #[inline]
add_co_owning_reference(&mut self, co_owning_reference: u64)3109 pub fn add_co_owning_reference(&mut self, co_owning_reference: u64) {
3110 self.fbb_.push_slot::<u64>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
3111 }
3112 #[inline]
add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>)3113 pub fn add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
3114 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
3115 }
3116 #[inline]
add_non_owning_reference(&mut self, non_owning_reference: u64)3117 pub fn add_non_owning_reference(&mut self, non_owning_reference: u64) {
3118 self.fbb_.push_slot::<u64>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
3119 }
3120 #[inline]
add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>)3121 pub fn add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
3122 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
3123 }
3124 #[inline]
add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases)3125 pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) {
3126 self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE);
3127 }
3128 #[inline]
add_any_unique(&mut self, any_unique: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>)3129 pub fn add_any_unique(&mut self, any_unique: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
3130 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique);
3131 }
3132 #[inline]
add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases)3133 pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) {
3134 self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE);
3135 }
3136 #[inline]
add_any_ambiguous(&mut self, any_ambiguous: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>)3137 pub fn add_any_ambiguous(&mut self, any_ambiguous: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
3138 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
3139 }
3140 #[inline]
add_vector_of_enums(&mut self, vector_of_enums: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Color>>)3141 pub fn add_vector_of_enums(&mut self, vector_of_enums: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Color>>) {
3142 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
3143 }
3144 #[inline]
add_signed_enum(&mut self, signed_enum: Race)3145 pub fn add_signed_enum(&mut self, signed_enum: Race) {
3146 self.fbb_.push_slot::<Race>(Monster::VT_SIGNED_ENUM, signed_enum, Race::None);
3147 }
3148 #[inline]
add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)3149 pub fn add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
3150 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
3151 }
3152 #[inline]
add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Stat<'b >>>>)3153 pub fn add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Stat<'b >>>>) {
3154 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
3155 }
3156 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b>3157 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
3158 let start = _fbb.start_table();
3159 MonsterBuilder {
3160 fbb_: _fbb,
3161 start_: start,
3162 }
3163 }
3164 #[inline]
finish(self) -> flatbuffers::WIPOffset<Monster<'a>>3165 pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
3166 let o = self.fbb_.end_table(self.start_);
3167 self.fbb_.required(o, Monster::VT_NAME,"name");
3168 flatbuffers::WIPOffset::new(o.value())
3169 }
3170 }
3171
3172 impl std::fmt::Debug for Monster<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result3173 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3174 let mut ds = f.debug_struct("Monster");
3175 ds.field("pos", &self.pos());
3176 ds.field("mana", &self.mana());
3177 ds.field("hp", &self.hp());
3178 ds.field("name", &self.name());
3179 ds.field("inventory", &self.inventory());
3180 ds.field("color", &self.color());
3181 ds.field("test_type", &self.test_type());
3182 match self.test_type() {
3183 Any::Monster => {
3184 if let Some(x) = self.test_as_monster() {
3185 ds.field("test", &x)
3186 } else {
3187 ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
3188 }
3189 },
3190 Any::TestSimpleTableWithEnum => {
3191 if let Some(x) = self.test_as_test_simple_table_with_enum() {
3192 ds.field("test", &x)
3193 } else {
3194 ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
3195 }
3196 },
3197 Any::MyGame_Example2_Monster => {
3198 if let Some(x) = self.test_as_my_game_example_2_monster() {
3199 ds.field("test", &x)
3200 } else {
3201 ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
3202 }
3203 },
3204 _ => {
3205 let x: Option<()> = None;
3206 ds.field("test", &x)
3207 },
3208 };
3209 ds.field("test4", &self.test4());
3210 ds.field("testarrayofstring", &self.testarrayofstring());
3211 ds.field("testarrayoftables", &self.testarrayoftables());
3212 ds.field("enemy", &self.enemy());
3213 ds.field("testnestedflatbuffer", &self.testnestedflatbuffer());
3214 ds.field("testempty", &self.testempty());
3215 ds.field("testbool", &self.testbool());
3216 ds.field("testhashs32_fnv1", &self.testhashs32_fnv1());
3217 ds.field("testhashu32_fnv1", &self.testhashu32_fnv1());
3218 ds.field("testhashs64_fnv1", &self.testhashs64_fnv1());
3219 ds.field("testhashu64_fnv1", &self.testhashu64_fnv1());
3220 ds.field("testhashs32_fnv1a", &self.testhashs32_fnv1a());
3221 ds.field("testhashu32_fnv1a", &self.testhashu32_fnv1a());
3222 ds.field("testhashs64_fnv1a", &self.testhashs64_fnv1a());
3223 ds.field("testhashu64_fnv1a", &self.testhashu64_fnv1a());
3224 ds.field("testarrayofbools", &self.testarrayofbools());
3225 ds.field("testf", &self.testf());
3226 ds.field("testf2", &self.testf2());
3227 ds.field("testf3", &self.testf3());
3228 ds.field("testarrayofstring2", &self.testarrayofstring2());
3229 ds.field("testarrayofsortedstruct", &self.testarrayofsortedstruct());
3230 ds.field("flex", &self.flex());
3231 ds.field("test5", &self.test5());
3232 ds.field("vector_of_longs", &self.vector_of_longs());
3233 ds.field("vector_of_doubles", &self.vector_of_doubles());
3234 ds.field("parent_namespace_test", &self.parent_namespace_test());
3235 ds.field("vector_of_referrables", &self.vector_of_referrables());
3236 ds.field("single_weak_reference", &self.single_weak_reference());
3237 ds.field("vector_of_weak_references", &self.vector_of_weak_references());
3238 ds.field("vector_of_strong_referrables", &self.vector_of_strong_referrables());
3239 ds.field("co_owning_reference", &self.co_owning_reference());
3240 ds.field("vector_of_co_owning_references", &self.vector_of_co_owning_references());
3241 ds.field("non_owning_reference", &self.non_owning_reference());
3242 ds.field("vector_of_non_owning_references", &self.vector_of_non_owning_references());
3243 ds.field("any_unique_type", &self.any_unique_type());
3244 match self.any_unique_type() {
3245 AnyUniqueAliases::M => {
3246 if let Some(x) = self.any_unique_as_m() {
3247 ds.field("any_unique", &x)
3248 } else {
3249 ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
3250 }
3251 },
3252 AnyUniqueAliases::TS => {
3253 if let Some(x) = self.any_unique_as_ts() {
3254 ds.field("any_unique", &x)
3255 } else {
3256 ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
3257 }
3258 },
3259 AnyUniqueAliases::M2 => {
3260 if let Some(x) = self.any_unique_as_m2() {
3261 ds.field("any_unique", &x)
3262 } else {
3263 ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
3264 }
3265 },
3266 _ => {
3267 let x: Option<()> = None;
3268 ds.field("any_unique", &x)
3269 },
3270 };
3271 ds.field("any_ambiguous_type", &self.any_ambiguous_type());
3272 match self.any_ambiguous_type() {
3273 AnyAmbiguousAliases::M1 => {
3274 if let Some(x) = self.any_ambiguous_as_m1() {
3275 ds.field("any_ambiguous", &x)
3276 } else {
3277 ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
3278 }
3279 },
3280 AnyAmbiguousAliases::M2 => {
3281 if let Some(x) = self.any_ambiguous_as_m2() {
3282 ds.field("any_ambiguous", &x)
3283 } else {
3284 ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
3285 }
3286 },
3287 AnyAmbiguousAliases::M3 => {
3288 if let Some(x) = self.any_ambiguous_as_m3() {
3289 ds.field("any_ambiguous", &x)
3290 } else {
3291 ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
3292 }
3293 },
3294 _ => {
3295 let x: Option<()> = None;
3296 ds.field("any_ambiguous", &x)
3297 },
3298 };
3299 ds.field("vector_of_enums", &self.vector_of_enums());
3300 ds.field("signed_enum", &self.signed_enum());
3301 ds.field("testrequirednestedflatbuffer", &self.testrequirednestedflatbuffer());
3302 ds.field("scalar_key_sorted_tables", &self.scalar_key_sorted_tables());
3303 ds.finish()
3304 }
3305 }
3306 #[non_exhaustive]
3307 #[derive(Debug, Clone, PartialEq)]
3308 pub struct MonsterT {
3309 pub pos: Option<Vec3T>,
3310 pub mana: i16,
3311 pub hp: i16,
3312 pub name: String,
3313 pub inventory: Option<Vec<u8>>,
3314 pub color: Color,
3315 pub test: AnyT,
3316 pub test4: Option<Vec<TestT>>,
3317 pub testarrayofstring: Option<Vec<String>>,
3318 pub testarrayoftables: Option<Vec<MonsterT>>,
3319 pub enemy: Option<Box<MonsterT>>,
3320 pub testnestedflatbuffer: Option<Vec<u8>>,
3321 pub testempty: Option<Box<StatT>>,
3322 pub testbool: bool,
3323 pub testhashs32_fnv1: i32,
3324 pub testhashu32_fnv1: u32,
3325 pub testhashs64_fnv1: i64,
3326 pub testhashu64_fnv1: u64,
3327 pub testhashs32_fnv1a: i32,
3328 pub testhashu32_fnv1a: u32,
3329 pub testhashs64_fnv1a: i64,
3330 pub testhashu64_fnv1a: u64,
3331 pub testarrayofbools: Option<Vec<bool>>,
3332 pub testf: f32,
3333 pub testf2: f32,
3334 pub testf3: f32,
3335 pub testarrayofstring2: Option<Vec<String>>,
3336 pub testarrayofsortedstruct: Option<Vec<AbilityT>>,
3337 pub flex: Option<Vec<u8>>,
3338 pub test5: Option<Vec<TestT>>,
3339 pub vector_of_longs: Option<Vec<i64>>,
3340 pub vector_of_doubles: Option<Vec<f64>>,
3341 pub parent_namespace_test: Option<Box<super::InParentNamespaceT>>,
3342 pub vector_of_referrables: Option<Vec<ReferrableT>>,
3343 pub single_weak_reference: u64,
3344 pub vector_of_weak_references: Option<Vec<u64>>,
3345 pub vector_of_strong_referrables: Option<Vec<ReferrableT>>,
3346 pub co_owning_reference: u64,
3347 pub vector_of_co_owning_references: Option<Vec<u64>>,
3348 pub non_owning_reference: u64,
3349 pub vector_of_non_owning_references: Option<Vec<u64>>,
3350 pub any_unique: AnyUniqueAliasesT,
3351 pub any_ambiguous: AnyAmbiguousAliasesT,
3352 pub vector_of_enums: Option<Vec<Color>>,
3353 pub signed_enum: Race,
3354 pub testrequirednestedflatbuffer: Option<Vec<u8>>,
3355 pub scalar_key_sorted_tables: Option<Vec<StatT>>,
3356 }
3357 impl Default for MonsterT {
default() -> Self3358 fn default() -> Self {
3359 Self {
3360 pos: None,
3361 mana: 150,
3362 hp: 100,
3363 name: "".to_string(),
3364 inventory: None,
3365 color: Color::Blue,
3366 test: AnyT::NONE,
3367 test4: None,
3368 testarrayofstring: None,
3369 testarrayoftables: None,
3370 enemy: None,
3371 testnestedflatbuffer: None,
3372 testempty: None,
3373 testbool: false,
3374 testhashs32_fnv1: 0,
3375 testhashu32_fnv1: 0,
3376 testhashs64_fnv1: 0,
3377 testhashu64_fnv1: 0,
3378 testhashs32_fnv1a: 0,
3379 testhashu32_fnv1a: 0,
3380 testhashs64_fnv1a: 0,
3381 testhashu64_fnv1a: 0,
3382 testarrayofbools: None,
3383 testf: 3.14159,
3384 testf2: 3.0,
3385 testf3: 0.0,
3386 testarrayofstring2: None,
3387 testarrayofsortedstruct: None,
3388 flex: None,
3389 test5: None,
3390 vector_of_longs: None,
3391 vector_of_doubles: None,
3392 parent_namespace_test: None,
3393 vector_of_referrables: None,
3394 single_weak_reference: 0,
3395 vector_of_weak_references: None,
3396 vector_of_strong_referrables: None,
3397 co_owning_reference: 0,
3398 vector_of_co_owning_references: None,
3399 non_owning_reference: 0,
3400 vector_of_non_owning_references: None,
3401 any_unique: AnyUniqueAliasesT::NONE,
3402 any_ambiguous: AnyAmbiguousAliasesT::NONE,
3403 vector_of_enums: None,
3404 signed_enum: Race::None,
3405 testrequirednestedflatbuffer: None,
3406 scalar_key_sorted_tables: None,
3407 }
3408 }
3409 }
3410 impl MonsterT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<Monster<'b>>3411 pub fn pack<'b>(
3412 &self,
3413 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
3414 ) -> flatbuffers::WIPOffset<Monster<'b>> {
3415 let pos_tmp = self.pos.as_ref().map(|x| x.pack());
3416 let pos = pos_tmp.as_ref();
3417 let mana = self.mana;
3418 let hp = self.hp;
3419 let name = Some({
3420 let x = &self.name;
3421 _fbb.create_string(x)
3422 });
3423 let inventory = self.inventory.as_ref().map(|x|{
3424 _fbb.create_vector(x)
3425 });
3426 let color = self.color;
3427 let test_type = self.test.any_type();
3428 let test = self.test.pack(_fbb);
3429 let test4 = self.test4.as_ref().map(|x|{
3430 let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
3431 });
3432 let testarrayofstring = self.testarrayofstring.as_ref().map(|x|{
3433 let w: Vec<_> = x.iter().map(|s| s.as_ref()).collect();_fbb.create_vector_of_strings(&w)
3434 });
3435 let testarrayoftables = self.testarrayoftables.as_ref().map(|x|{
3436 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
3437 });
3438 let enemy = self.enemy.as_ref().map(|x|{
3439 x.pack(_fbb)
3440 });
3441 let testnestedflatbuffer = self.testnestedflatbuffer.as_ref().map(|x|{
3442 _fbb.create_vector(x)
3443 });
3444 let testempty = self.testempty.as_ref().map(|x|{
3445 x.pack(_fbb)
3446 });
3447 let testbool = self.testbool;
3448 let testhashs32_fnv1 = self.testhashs32_fnv1;
3449 let testhashu32_fnv1 = self.testhashu32_fnv1;
3450 let testhashs64_fnv1 = self.testhashs64_fnv1;
3451 let testhashu64_fnv1 = self.testhashu64_fnv1;
3452 let testhashs32_fnv1a = self.testhashs32_fnv1a;
3453 let testhashu32_fnv1a = self.testhashu32_fnv1a;
3454 let testhashs64_fnv1a = self.testhashs64_fnv1a;
3455 let testhashu64_fnv1a = self.testhashu64_fnv1a;
3456 let testarrayofbools = self.testarrayofbools.as_ref().map(|x|{
3457 _fbb.create_vector(x)
3458 });
3459 let testf = self.testf;
3460 let testf2 = self.testf2;
3461 let testf3 = self.testf3;
3462 let testarrayofstring2 = self.testarrayofstring2.as_ref().map(|x|{
3463 let w: Vec<_> = x.iter().map(|s| s.as_ref()).collect();_fbb.create_vector_of_strings(&w)
3464 });
3465 let testarrayofsortedstruct = self.testarrayofsortedstruct.as_ref().map(|x|{
3466 let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
3467 });
3468 let flex = self.flex.as_ref().map(|x|{
3469 _fbb.create_vector(x)
3470 });
3471 let test5 = self.test5.as_ref().map(|x|{
3472 let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
3473 });
3474 let vector_of_longs = self.vector_of_longs.as_ref().map(|x|{
3475 _fbb.create_vector(x)
3476 });
3477 let vector_of_doubles = self.vector_of_doubles.as_ref().map(|x|{
3478 _fbb.create_vector(x)
3479 });
3480 let parent_namespace_test = self.parent_namespace_test.as_ref().map(|x|{
3481 x.pack(_fbb)
3482 });
3483 let vector_of_referrables = self.vector_of_referrables.as_ref().map(|x|{
3484 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
3485 });
3486 let single_weak_reference = self.single_weak_reference;
3487 let vector_of_weak_references = self.vector_of_weak_references.as_ref().map(|x|{
3488 _fbb.create_vector(x)
3489 });
3490 let vector_of_strong_referrables = self.vector_of_strong_referrables.as_ref().map(|x|{
3491 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
3492 });
3493 let co_owning_reference = self.co_owning_reference;
3494 let vector_of_co_owning_references = self.vector_of_co_owning_references.as_ref().map(|x|{
3495 _fbb.create_vector(x)
3496 });
3497 let non_owning_reference = self.non_owning_reference;
3498 let vector_of_non_owning_references = self.vector_of_non_owning_references.as_ref().map(|x|{
3499 _fbb.create_vector(x)
3500 });
3501 let any_unique_type = self.any_unique.any_unique_aliases_type();
3502 let any_unique = self.any_unique.pack(_fbb);
3503 let any_ambiguous_type = self.any_ambiguous.any_ambiguous_aliases_type();
3504 let any_ambiguous = self.any_ambiguous.pack(_fbb);
3505 let vector_of_enums = self.vector_of_enums.as_ref().map(|x|{
3506 _fbb.create_vector(x)
3507 });
3508 let signed_enum = self.signed_enum;
3509 let testrequirednestedflatbuffer = self.testrequirednestedflatbuffer.as_ref().map(|x|{
3510 _fbb.create_vector(x)
3511 });
3512 let scalar_key_sorted_tables = self.scalar_key_sorted_tables.as_ref().map(|x|{
3513 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
3514 });
3515 Monster::create(_fbb, &MonsterArgs{
3516 pos,
3517 mana,
3518 hp,
3519 name,
3520 inventory,
3521 color,
3522 test_type,
3523 test,
3524 test4,
3525 testarrayofstring,
3526 testarrayoftables,
3527 enemy,
3528 testnestedflatbuffer,
3529 testempty,
3530 testbool,
3531 testhashs32_fnv1,
3532 testhashu32_fnv1,
3533 testhashs64_fnv1,
3534 testhashu64_fnv1,
3535 testhashs32_fnv1a,
3536 testhashu32_fnv1a,
3537 testhashs64_fnv1a,
3538 testhashu64_fnv1a,
3539 testarrayofbools,
3540 testf,
3541 testf2,
3542 testf3,
3543 testarrayofstring2,
3544 testarrayofsortedstruct,
3545 flex,
3546 test5,
3547 vector_of_longs,
3548 vector_of_doubles,
3549 parent_namespace_test,
3550 vector_of_referrables,
3551 single_weak_reference,
3552 vector_of_weak_references,
3553 vector_of_strong_referrables,
3554 co_owning_reference,
3555 vector_of_co_owning_references,
3556 non_owning_reference,
3557 vector_of_non_owning_references,
3558 any_unique_type,
3559 any_unique,
3560 any_ambiguous_type,
3561 any_ambiguous,
3562 vector_of_enums,
3563 signed_enum,
3564 testrequirednestedflatbuffer,
3565 scalar_key_sorted_tables,
3566 })
3567 }
3568 }
3569 pub enum TypeAliasesOffset {}
3570 #[derive(Copy, Clone, PartialEq)]
3571
3572 pub struct TypeAliases<'a> {
3573 pub _tab: flatbuffers::Table<'a>,
3574 }
3575
3576 impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> {
3577 type Inner = TypeAliases<'a>;
3578 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner3579 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
3580 Self { _tab: flatbuffers::Table { buf, loc } }
3581 }
3582 }
3583
3584 impl<'a> TypeAliases<'a> {
get_fully_qualified_name() -> &'static str3585 pub const fn get_fully_qualified_name() -> &'static str {
3586 "MyGame.Example.TypeAliases"
3587 }
3588
3589 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self3590 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
3591 TypeAliases { _tab: table }
3592 }
3593 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args TypeAliasesArgs<'args>) -> flatbuffers::WIPOffset<TypeAliases<'bldr>>3594 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
3595 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
3596 args: &'args TypeAliasesArgs<'args>) -> flatbuffers::WIPOffset<TypeAliases<'bldr>> {
3597 let mut builder = TypeAliasesBuilder::new(_fbb);
3598 builder.add_f64_(args.f64_);
3599 builder.add_u64_(args.u64_);
3600 builder.add_i64_(args.i64_);
3601 if let Some(x) = args.vf64 { builder.add_vf64(x); }
3602 if let Some(x) = args.v8 { builder.add_v8(x); }
3603 builder.add_f32_(args.f32_);
3604 builder.add_u32_(args.u32_);
3605 builder.add_i32_(args.i32_);
3606 builder.add_u16_(args.u16_);
3607 builder.add_i16_(args.i16_);
3608 builder.add_u8_(args.u8_);
3609 builder.add_i8_(args.i8_);
3610 builder.finish()
3611 }
3612
unpack(&self) -> TypeAliasesT3613 pub fn unpack(&self) -> TypeAliasesT {
3614 let i8_ = self.i8_();
3615 let u8_ = self.u8_();
3616 let i16_ = self.i16_();
3617 let u16_ = self.u16_();
3618 let i32_ = self.i32_();
3619 let u32_ = self.u32_();
3620 let i64_ = self.i64_();
3621 let u64_ = self.u64_();
3622 let f32_ = self.f32_();
3623 let f64_ = self.f64_();
3624 let v8 = self.v8().map(|x| {
3625 x.to_vec()
3626 });
3627 let vf64 = self.vf64().map(|x| {
3628 x.into_iter().collect()
3629 });
3630 TypeAliasesT {
3631 i8_,
3632 u8_,
3633 i16_,
3634 u16_,
3635 i32_,
3636 u32_,
3637 i64_,
3638 u64_,
3639 f32_,
3640 f64_,
3641 v8,
3642 vf64,
3643 }
3644 }
3645 pub const VT_I8_: flatbuffers::VOffsetT = 4;
3646 pub const VT_U8_: flatbuffers::VOffsetT = 6;
3647 pub const VT_I16_: flatbuffers::VOffsetT = 8;
3648 pub const VT_U16_: flatbuffers::VOffsetT = 10;
3649 pub const VT_I32_: flatbuffers::VOffsetT = 12;
3650 pub const VT_U32_: flatbuffers::VOffsetT = 14;
3651 pub const VT_I64_: flatbuffers::VOffsetT = 16;
3652 pub const VT_U64_: flatbuffers::VOffsetT = 18;
3653 pub const VT_F32_: flatbuffers::VOffsetT = 20;
3654 pub const VT_F64_: flatbuffers::VOffsetT = 22;
3655 pub const VT_V8: flatbuffers::VOffsetT = 24;
3656 pub const VT_VF64: flatbuffers::VOffsetT = 26;
3657
3658 #[inline]
i8_(&self) -> i83659 pub fn i8_(&self) -> i8 {
3660 self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()
3661 }
3662 #[inline]
u8_(&self) -> u83663 pub fn u8_(&self) -> u8 {
3664 self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()
3665 }
3666 #[inline]
i16_(&self) -> i163667 pub fn i16_(&self) -> i16 {
3668 self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()
3669 }
3670 #[inline]
u16_(&self) -> u163671 pub fn u16_(&self) -> u16 {
3672 self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()
3673 }
3674 #[inline]
i32_(&self) -> i323675 pub fn i32_(&self) -> i32 {
3676 self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()
3677 }
3678 #[inline]
u32_(&self) -> u323679 pub fn u32_(&self) -> u32 {
3680 self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()
3681 }
3682 #[inline]
i64_(&self) -> i643683 pub fn i64_(&self) -> i64 {
3684 self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()
3685 }
3686 #[inline]
u64_(&self) -> u643687 pub fn u64_(&self) -> u64 {
3688 self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()
3689 }
3690 #[inline]
f32_(&self) -> f323691 pub fn f32_(&self) -> f32 {
3692 self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()
3693 }
3694 #[inline]
f64_(&self) -> f643695 pub fn f64_(&self) -> f64 {
3696 self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()
3697 }
3698 #[inline]
v8(&self) -> Option<&'a [i8]>3699 pub fn v8(&self) -> Option<&'a [i8]> {
3700 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None).map(|v| v.safe_slice())
3701 }
3702 #[inline]
vf64(&self) -> Option<flatbuffers::Vector<'a, f64>>3703 pub fn vf64(&self) -> Option<flatbuffers::Vector<'a, f64>> {
3704 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(TypeAliases::VT_VF64, None)
3705 }
3706 }
3707
3708 impl flatbuffers::Verifiable for TypeAliases<'_> {
3709 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>3710 fn run_verifier(
3711 v: &mut flatbuffers::Verifier, pos: usize
3712 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
3713 use self::flatbuffers::Verifiable;
3714 v.visit_table(pos)?
3715 .visit_field::<i8>(&"i8_", Self::VT_I8_, false)?
3716 .visit_field::<u8>(&"u8_", Self::VT_U8_, false)?
3717 .visit_field::<i16>(&"i16_", Self::VT_I16_, false)?
3718 .visit_field::<u16>(&"u16_", Self::VT_U16_, false)?
3719 .visit_field::<i32>(&"i32_", Self::VT_I32_, false)?
3720 .visit_field::<u32>(&"u32_", Self::VT_U32_, false)?
3721 .visit_field::<i64>(&"i64_", Self::VT_I64_, false)?
3722 .visit_field::<u64>(&"u64_", Self::VT_U64_, false)?
3723 .visit_field::<f32>(&"f32_", Self::VT_F32_, false)?
3724 .visit_field::<f64>(&"f64_", Self::VT_F64_, false)?
3725 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i8>>>(&"v8", Self::VT_V8, false)?
3726 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>(&"vf64", Self::VT_VF64, false)?
3727 .finish();
3728 Ok(())
3729 }
3730 }
3731 pub struct TypeAliasesArgs<'a> {
3732 pub i8_: i8,
3733 pub u8_: u8,
3734 pub i16_: i16,
3735 pub u16_: u16,
3736 pub i32_: i32,
3737 pub u32_: u32,
3738 pub i64_: i64,
3739 pub u64_: u64,
3740 pub f32_: f32,
3741 pub f64_: f64,
3742 pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i8>>>,
3743 pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
3744 }
3745 impl<'a> Default for TypeAliasesArgs<'a> {
3746 #[inline]
default() -> Self3747 fn default() -> Self {
3748 TypeAliasesArgs {
3749 i8_: 0,
3750 u8_: 0,
3751 i16_: 0,
3752 u16_: 0,
3753 i32_: 0,
3754 u32_: 0,
3755 i64_: 0,
3756 u64_: 0,
3757 f32_: 0.0,
3758 f64_: 0.0,
3759 v8: None,
3760 vf64: None,
3761 }
3762 }
3763 }
3764 pub struct TypeAliasesBuilder<'a: 'b, 'b> {
3765 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
3766 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
3767 }
3768 impl<'a: 'b, 'b> TypeAliasesBuilder<'a, 'b> {
3769 #[inline]
add_i8_(&mut self, i8_: i8)3770 pub fn add_i8_(&mut self, i8_: i8) {
3771 self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
3772 }
3773 #[inline]
add_u8_(&mut self, u8_: u8)3774 pub fn add_u8_(&mut self, u8_: u8) {
3775 self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0);
3776 }
3777 #[inline]
add_i16_(&mut self, i16_: i16)3778 pub fn add_i16_(&mut self, i16_: i16) {
3779 self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0);
3780 }
3781 #[inline]
add_u16_(&mut self, u16_: u16)3782 pub fn add_u16_(&mut self, u16_: u16) {
3783 self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0);
3784 }
3785 #[inline]
add_i32_(&mut self, i32_: i32)3786 pub fn add_i32_(&mut self, i32_: i32) {
3787 self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0);
3788 }
3789 #[inline]
add_u32_(&mut self, u32_: u32)3790 pub fn add_u32_(&mut self, u32_: u32) {
3791 self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0);
3792 }
3793 #[inline]
add_i64_(&mut self, i64_: i64)3794 pub fn add_i64_(&mut self, i64_: i64) {
3795 self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0);
3796 }
3797 #[inline]
add_u64_(&mut self, u64_: u64)3798 pub fn add_u64_(&mut self, u64_: u64) {
3799 self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0);
3800 }
3801 #[inline]
add_f32_(&mut self, f32_: f32)3802 pub fn add_f32_(&mut self, f32_: f32) {
3803 self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0);
3804 }
3805 #[inline]
add_f64_(&mut self, f64_: f64)3806 pub fn add_f64_(&mut self, f64_: f64) {
3807 self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
3808 }
3809 #[inline]
add_v8(&mut self, v8: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>)3810 pub fn add_v8(&mut self, v8: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>) {
3811 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
3812 }
3813 #[inline]
add_vf64(&mut self, vf64: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>)3814 pub fn add_vf64(&mut self, vf64: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
3815 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
3816 }
3817 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TypeAliasesBuilder<'a, 'b>3818 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TypeAliasesBuilder<'a, 'b> {
3819 let start = _fbb.start_table();
3820 TypeAliasesBuilder {
3821 fbb_: _fbb,
3822 start_: start,
3823 }
3824 }
3825 #[inline]
finish(self) -> flatbuffers::WIPOffset<TypeAliases<'a>>3826 pub fn finish(self) -> flatbuffers::WIPOffset<TypeAliases<'a>> {
3827 let o = self.fbb_.end_table(self.start_);
3828 flatbuffers::WIPOffset::new(o.value())
3829 }
3830 }
3831
3832 impl std::fmt::Debug for TypeAliases<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result3833 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3834 let mut ds = f.debug_struct("TypeAliases");
3835 ds.field("i8_", &self.i8_());
3836 ds.field("u8_", &self.u8_());
3837 ds.field("i16_", &self.i16_());
3838 ds.field("u16_", &self.u16_());
3839 ds.field("i32_", &self.i32_());
3840 ds.field("u32_", &self.u32_());
3841 ds.field("i64_", &self.i64_());
3842 ds.field("u64_", &self.u64_());
3843 ds.field("f32_", &self.f32_());
3844 ds.field("f64_", &self.f64_());
3845 ds.field("v8", &self.v8());
3846 ds.field("vf64", &self.vf64());
3847 ds.finish()
3848 }
3849 }
3850 #[non_exhaustive]
3851 #[derive(Debug, Clone, PartialEq)]
3852 pub struct TypeAliasesT {
3853 pub i8_: i8,
3854 pub u8_: u8,
3855 pub i16_: i16,
3856 pub u16_: u16,
3857 pub i32_: i32,
3858 pub u32_: u32,
3859 pub i64_: i64,
3860 pub u64_: u64,
3861 pub f32_: f32,
3862 pub f64_: f64,
3863 pub v8: Option<Vec<i8>>,
3864 pub vf64: Option<Vec<f64>>,
3865 }
3866 impl Default for TypeAliasesT {
default() -> Self3867 fn default() -> Self {
3868 Self {
3869 i8_: 0,
3870 u8_: 0,
3871 i16_: 0,
3872 u16_: 0,
3873 i32_: 0,
3874 u32_: 0,
3875 i64_: 0,
3876 u64_: 0,
3877 f32_: 0.0,
3878 f64_: 0.0,
3879 v8: None,
3880 vf64: None,
3881 }
3882 }
3883 }
3884 impl TypeAliasesT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<TypeAliases<'b>>3885 pub fn pack<'b>(
3886 &self,
3887 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
3888 ) -> flatbuffers::WIPOffset<TypeAliases<'b>> {
3889 let i8_ = self.i8_;
3890 let u8_ = self.u8_;
3891 let i16_ = self.i16_;
3892 let u16_ = self.u16_;
3893 let i32_ = self.i32_;
3894 let u32_ = self.u32_;
3895 let i64_ = self.i64_;
3896 let u64_ = self.u64_;
3897 let f32_ = self.f32_;
3898 let f64_ = self.f64_;
3899 let v8 = self.v8.as_ref().map(|x|{
3900 _fbb.create_vector(x)
3901 });
3902 let vf64 = self.vf64.as_ref().map(|x|{
3903 _fbb.create_vector(x)
3904 });
3905 TypeAliases::create(_fbb, &TypeAliasesArgs{
3906 i8_,
3907 u8_,
3908 i16_,
3909 u16_,
3910 i32_,
3911 u32_,
3912 i64_,
3913 u64_,
3914 f32_,
3915 f64_,
3916 v8,
3917 vf64,
3918 })
3919 }
3920 }
3921 #[inline]
3922 #[deprecated(since="2.0.0", note="Deprecated in favor of `root_as...` methods.")]
get_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a>3923 pub fn get_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
3924 unsafe { flatbuffers::root_unchecked::<Monster<'a>>(buf) }
3925 }
3926
3927 #[inline]
3928 #[deprecated(since="2.0.0", note="Deprecated in favor of `root_as...` methods.")]
get_size_prefixed_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a>3929 pub fn get_size_prefixed_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
3930 unsafe { flatbuffers::size_prefixed_root_unchecked::<Monster<'a>>(buf) }
3931 }
3932
3933 #[inline]
3934 /// Verifies that a buffer of bytes contains a `Monster`
3935 /// and returns it.
3936 /// Note that verification is still experimental and may not
3937 /// catch every error, or be maximally performant. For the
3938 /// previous, unchecked, behavior use
3939 /// `root_as_monster_unchecked`.
root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer>3940 pub fn root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
3941 flatbuffers::root::<Monster>(buf)
3942 }
3943 #[inline]
3944 /// Verifies that a buffer of bytes contains a size prefixed
3945 /// `Monster` and returns it.
3946 /// Note that verification is still experimental and may not
3947 /// catch every error, or be maximally performant. For the
3948 /// previous, unchecked, behavior use
3949 /// `size_prefixed_root_as_monster_unchecked`.
size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer>3950 pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
3951 flatbuffers::size_prefixed_root::<Monster>(buf)
3952 }
3953 #[inline]
3954 /// Verifies, with the given options, that a buffer of bytes
3955 /// contains a `Monster` and returns it.
3956 /// Note that verification is still experimental and may not
3957 /// catch every error, or be maximally performant. For the
3958 /// previous, unchecked, behavior use
3959 /// `root_as_monster_unchecked`.
root_as_monster_with_opts<'b, 'o>( opts: &'o flatbuffers::VerifierOptions, buf: &'b [u8], ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer>3960 pub fn root_as_monster_with_opts<'b, 'o>(
3961 opts: &'o flatbuffers::VerifierOptions,
3962 buf: &'b [u8],
3963 ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer> {
3964 flatbuffers::root_with_opts::<Monster<'b>>(opts, buf)
3965 }
3966 #[inline]
3967 /// Verifies, with the given verifier options, that a buffer of
3968 /// bytes contains a size prefixed `Monster` and returns
3969 /// it. Note that verification is still experimental and may not
3970 /// catch every error, or be maximally performant. For the
3971 /// previous, unchecked, behavior use
3972 /// `root_as_monster_unchecked`.
size_prefixed_root_as_monster_with_opts<'b, 'o>( opts: &'o flatbuffers::VerifierOptions, buf: &'b [u8], ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer>3973 pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
3974 opts: &'o flatbuffers::VerifierOptions,
3975 buf: &'b [u8],
3976 ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer> {
3977 flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf)
3978 }
3979 #[inline]
3980 /// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
3981 /// # Safety
3982 /// Callers must trust the given bytes do indeed contain a valid `Monster`.
root_as_monster_unchecked(buf: &[u8]) -> Monster3983 pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster {
3984 flatbuffers::root_unchecked::<Monster>(buf)
3985 }
3986 #[inline]
3987 /// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
3988 /// # Safety
3989 /// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster3990 pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster {
3991 flatbuffers::size_prefixed_root_unchecked::<Monster>(buf)
3992 }
3993 pub const MONSTER_IDENTIFIER: &str = "MONS";
3994
3995 #[inline]
monster_buffer_has_identifier(buf: &[u8]) -> bool3996 pub fn monster_buffer_has_identifier(buf: &[u8]) -> bool {
3997 flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, false)
3998 }
3999
4000 #[inline]
monster_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool4001 pub fn monster_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
4002 flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, true)
4003 }
4004
4005 pub const MONSTER_EXTENSION: &str = "mon";
4006
4007 #[inline]
finish_monster_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>)4008 pub fn finish_monster_buffer<'a, 'b>(
4009 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
4010 root: flatbuffers::WIPOffset<Monster<'a>>) {
4011 fbb.finish(root, Some(MONSTER_IDENTIFIER));
4012 }
4013
4014 #[inline]
finish_size_prefixed_monster_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>)4015 pub fn finish_size_prefixed_monster_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>) {
4016 fbb.finish_size_prefixed(root, Some(MONSTER_IDENTIFIER));
4017 }
4018 } // pub mod Example
4019 } // pub mod MyGame
4020
4021