...

Text file src/github.com/google/flatbuffers/tests/monster_test/my_game/example/monster_generated.rs

Documentation: github.com/google/flatbuffers/tests/monster_test/my_game/example

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

View as plain text