1 // automatically generated by the FlatBuffers compiler, do not modify
2 // @generated
3 extern crate alloc;
4 extern crate flatbuffers;
5 use alloc::boxed::Box;
6 use alloc::string::{String, ToString};
7 use alloc::vec::Vec;
8 use core::mem;
9 use core::cmp::Ordering;
10 use self::flatbuffers::{EndianScalar, Follow};
11 use super::*;
12 pub enum MonsterOffset {}
13 #[derive(Copy, Clone, PartialEq)]
14
15 /// an example documentation comment: "monster object"
16 pub struct Monster<'a> {
17 pub _tab: flatbuffers::Table<'a>,
18 }
19
20 impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
21 type Inner = Monster<'a>;
22 #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner23 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
24 Self { _tab: flatbuffers::Table { buf, loc } }
25 }
26 }
27
28 impl<'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
get_fully_qualified_name() -> &'static str83 pub const fn get_fully_qualified_name() -> &'static str {
84 "MyGame.Example.Monster"
85 }
86
87 #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self88 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
89 Monster { _tab: table }
90 }
91 #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args MonsterArgs<'args> ) -> flatbuffers::WIPOffset<Monster<'bldr>>92 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
93 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
94 args: &'args MonsterArgs<'args>
95 ) -> flatbuffers::WIPOffset<Monster<'bldr>> {
96 let mut builder = MonsterBuilder::new(_fbb);
97 builder.add_long_enum_normal_default(args.long_enum_normal_default);
98 builder.add_long_enum_non_enum_default(args.long_enum_non_enum_default);
99 builder.add_non_owning_reference(args.non_owning_reference);
100 builder.add_co_owning_reference(args.co_owning_reference);
101 builder.add_single_weak_reference(args.single_weak_reference);
102 builder.add_testhashu64_fnv1a(args.testhashu64_fnv1a);
103 builder.add_testhashs64_fnv1a(args.testhashs64_fnv1a);
104 builder.add_testhashu64_fnv1(args.testhashu64_fnv1);
105 builder.add_testhashs64_fnv1(args.testhashs64_fnv1);
106 if let Some(x) = args.native_inline { builder.add_native_inline(x); }
107 if let Some(x) = args.scalar_key_sorted_tables { builder.add_scalar_key_sorted_tables(x); }
108 if let Some(x) = args.testrequirednestedflatbuffer { builder.add_testrequirednestedflatbuffer(x); }
109 if let Some(x) = args.vector_of_enums { builder.add_vector_of_enums(x); }
110 if let Some(x) = args.any_ambiguous { builder.add_any_ambiguous(x); }
111 if let Some(x) = args.any_unique { builder.add_any_unique(x); }
112 if let Some(x) = args.vector_of_non_owning_references { builder.add_vector_of_non_owning_references(x); }
113 if let Some(x) = args.vector_of_co_owning_references { builder.add_vector_of_co_owning_references(x); }
114 if let Some(x) = args.vector_of_strong_referrables { builder.add_vector_of_strong_referrables(x); }
115 if let Some(x) = args.vector_of_weak_references { builder.add_vector_of_weak_references(x); }
116 if let Some(x) = args.vector_of_referrables { builder.add_vector_of_referrables(x); }
117 if let Some(x) = args.parent_namespace_test { builder.add_parent_namespace_test(x); }
118 if let Some(x) = args.vector_of_doubles { builder.add_vector_of_doubles(x); }
119 if let Some(x) = args.vector_of_longs { builder.add_vector_of_longs(x); }
120 if let Some(x) = args.test5 { builder.add_test5(x); }
121 if let Some(x) = args.flex { builder.add_flex(x); }
122 if let Some(x) = args.testarrayofsortedstruct { builder.add_testarrayofsortedstruct(x); }
123 if let Some(x) = args.testarrayofstring2 { builder.add_testarrayofstring2(x); }
124 builder.add_testf3(args.testf3);
125 builder.add_testf2(args.testf2);
126 builder.add_testf(args.testf);
127 if let Some(x) = args.testarrayofbools { builder.add_testarrayofbools(x); }
128 builder.add_testhashu32_fnv1a(args.testhashu32_fnv1a);
129 builder.add_testhashs32_fnv1a(args.testhashs32_fnv1a);
130 builder.add_testhashu32_fnv1(args.testhashu32_fnv1);
131 builder.add_testhashs32_fnv1(args.testhashs32_fnv1);
132 if let Some(x) = args.testempty { builder.add_testempty(x); }
133 if let Some(x) = args.testnestedflatbuffer { builder.add_testnestedflatbuffer(x); }
134 if let Some(x) = args.enemy { builder.add_enemy(x); }
135 if let Some(x) = args.testarrayoftables { builder.add_testarrayoftables(x); }
136 if let Some(x) = args.testarrayofstring { builder.add_testarrayofstring(x); }
137 if let Some(x) = args.test4 { builder.add_test4(x); }
138 if let Some(x) = args.test { builder.add_test(x); }
139 if let Some(x) = args.inventory { builder.add_inventory(x); }
140 if let Some(x) = args.name { builder.add_name(x); }
141 if let Some(x) = args.pos { builder.add_pos(x); }
142 builder.add_hp(args.hp);
143 builder.add_mana(args.mana);
144 builder.add_signed_enum(args.signed_enum);
145 builder.add_any_ambiguous_type(args.any_ambiguous_type);
146 builder.add_any_unique_type(args.any_unique_type);
147 builder.add_testbool(args.testbool);
148 builder.add_test_type(args.test_type);
149 builder.add_color(args.color);
150 builder.finish()
151 }
152
unpack(&self) -> MonsterT153 pub fn unpack(&self) -> MonsterT {
154 let pos = self.pos().map(|x| {
155 x.unpack()
156 });
157 let mana = self.mana();
158 let hp = self.hp();
159 let name = {
160 let x = self.name();
161 x.to_string()
162 };
163 let inventory = self.inventory().map(|x| {
164 x.to_vec()
165 });
166 let color = self.color();
167 let test = match self.test_type() {
168 Any::NONE => AnyT::NONE,
169 Any::Monster => AnyT::Monster(Box::new(
170 self.test_as_monster()
171 .expect("Invalid union table, expected `Any::Monster`.")
172 .unpack()
173 )),
174 Any::TestSimpleTableWithEnum => AnyT::TestSimpleTableWithEnum(Box::new(
175 self.test_as_test_simple_table_with_enum()
176 .expect("Invalid union table, expected `Any::TestSimpleTableWithEnum`.")
177 .unpack()
178 )),
179 Any::MyGame_Example2_Monster => AnyT::MyGameExample2Monster(Box::new(
180 self.test_as_my_game_example_2_monster()
181 .expect("Invalid union table, expected `Any::MyGame_Example2_Monster`.")
182 .unpack()
183 )),
184 _ => AnyT::NONE,
185 };
186 let test4 = self.test4().map(|x| {
187 x.iter().map(|t| t.unpack()).collect()
188 });
189 let testarrayofstring = self.testarrayofstring().map(|x| {
190 x.iter().map(|s| s.to_string()).collect()
191 });
192 let testarrayoftables = self.testarrayoftables().map(|x| {
193 x.iter().map(|t| t.unpack()).collect()
194 });
195 let enemy = self.enemy().map(|x| {
196 Box::new(x.unpack())
197 });
198 let testnestedflatbuffer = self.testnestedflatbuffer().map(|x| {
199 x.to_vec()
200 });
201 let testempty = self.testempty().map(|x| {
202 Box::new(x.unpack())
203 });
204 let testbool = self.testbool();
205 let testhashs32_fnv1 = self.testhashs32_fnv1();
206 let testhashu32_fnv1 = self.testhashu32_fnv1();
207 let testhashs64_fnv1 = self.testhashs64_fnv1();
208 let testhashu64_fnv1 = self.testhashu64_fnv1();
209 let testhashs32_fnv1a = self.testhashs32_fnv1a();
210 let testhashu32_fnv1a = self.testhashu32_fnv1a();
211 let testhashs64_fnv1a = self.testhashs64_fnv1a();
212 let testhashu64_fnv1a = self.testhashu64_fnv1a();
213 let testarrayofbools = self.testarrayofbools().map(|x| {
214 x.to_vec()
215 });
216 let testf = self.testf();
217 let testf2 = self.testf2();
218 let testf3 = self.testf3();
219 let testarrayofstring2 = self.testarrayofstring2().map(|x| {
220 x.iter().map(|s| s.to_string()).collect()
221 });
222 let testarrayofsortedstruct = self.testarrayofsortedstruct().map(|x| {
223 x.iter().map(|t| t.unpack()).collect()
224 });
225 let flex = self.flex().map(|x| {
226 x.to_vec()
227 });
228 let test5 = self.test5().map(|x| {
229 x.iter().map(|t| t.unpack()).collect()
230 });
231 let vector_of_longs = self.vector_of_longs().map(|x| {
232 x.into_iter().collect()
233 });
234 let vector_of_doubles = self.vector_of_doubles().map(|x| {
235 x.into_iter().collect()
236 });
237 let parent_namespace_test = self.parent_namespace_test().map(|x| {
238 Box::new(x.unpack())
239 });
240 let vector_of_referrables = self.vector_of_referrables().map(|x| {
241 x.iter().map(|t| t.unpack()).collect()
242 });
243 let single_weak_reference = self.single_weak_reference();
244 let vector_of_weak_references = self.vector_of_weak_references().map(|x| {
245 x.into_iter().collect()
246 });
247 let vector_of_strong_referrables = self.vector_of_strong_referrables().map(|x| {
248 x.iter().map(|t| t.unpack()).collect()
249 });
250 let co_owning_reference = self.co_owning_reference();
251 let vector_of_co_owning_references = self.vector_of_co_owning_references().map(|x| {
252 x.into_iter().collect()
253 });
254 let non_owning_reference = self.non_owning_reference();
255 let vector_of_non_owning_references = self.vector_of_non_owning_references().map(|x| {
256 x.into_iter().collect()
257 });
258 let any_unique = match self.any_unique_type() {
259 AnyUniqueAliases::NONE => AnyUniqueAliasesT::NONE,
260 AnyUniqueAliases::M => AnyUniqueAliasesT::M(Box::new(
261 self.any_unique_as_m()
262 .expect("Invalid union table, expected `AnyUniqueAliases::M`.")
263 .unpack()
264 )),
265 AnyUniqueAliases::TS => AnyUniqueAliasesT::TS(Box::new(
266 self.any_unique_as_ts()
267 .expect("Invalid union table, expected `AnyUniqueAliases::TS`.")
268 .unpack()
269 )),
270 AnyUniqueAliases::M2 => AnyUniqueAliasesT::M2(Box::new(
271 self.any_unique_as_m2()
272 .expect("Invalid union table, expected `AnyUniqueAliases::M2`.")
273 .unpack()
274 )),
275 _ => AnyUniqueAliasesT::NONE,
276 };
277 let any_ambiguous = match self.any_ambiguous_type() {
278 AnyAmbiguousAliases::NONE => AnyAmbiguousAliasesT::NONE,
279 AnyAmbiguousAliases::M1 => AnyAmbiguousAliasesT::M1(Box::new(
280 self.any_ambiguous_as_m1()
281 .expect("Invalid union table, expected `AnyAmbiguousAliases::M1`.")
282 .unpack()
283 )),
284 AnyAmbiguousAliases::M2 => AnyAmbiguousAliasesT::M2(Box::new(
285 self.any_ambiguous_as_m2()
286 .expect("Invalid union table, expected `AnyAmbiguousAliases::M2`.")
287 .unpack()
288 )),
289 AnyAmbiguousAliases::M3 => AnyAmbiguousAliasesT::M3(Box::new(
290 self.any_ambiguous_as_m3()
291 .expect("Invalid union table, expected `AnyAmbiguousAliases::M3`.")
292 .unpack()
293 )),
294 _ => AnyAmbiguousAliasesT::NONE,
295 };
296 let vector_of_enums = self.vector_of_enums().map(|x| {
297 x.into_iter().collect()
298 });
299 let signed_enum = self.signed_enum();
300 let testrequirednestedflatbuffer = self.testrequirednestedflatbuffer().map(|x| {
301 x.to_vec()
302 });
303 let scalar_key_sorted_tables = self.scalar_key_sorted_tables().map(|x| {
304 x.iter().map(|t| t.unpack()).collect()
305 });
306 let native_inline = self.native_inline().map(|x| {
307 x.unpack()
308 });
309 let long_enum_non_enum_default = self.long_enum_non_enum_default();
310 let long_enum_normal_default = self.long_enum_normal_default();
311 MonsterT {
312 pos,
313 mana,
314 hp,
315 name,
316 inventory,
317 color,
318 test,
319 test4,
320 testarrayofstring,
321 testarrayoftables,
322 enemy,
323 testnestedflatbuffer,
324 testempty,
325 testbool,
326 testhashs32_fnv1,
327 testhashu32_fnv1,
328 testhashs64_fnv1,
329 testhashu64_fnv1,
330 testhashs32_fnv1a,
331 testhashu32_fnv1a,
332 testhashs64_fnv1a,
333 testhashu64_fnv1a,
334 testarrayofbools,
335 testf,
336 testf2,
337 testf3,
338 testarrayofstring2,
339 testarrayofsortedstruct,
340 flex,
341 test5,
342 vector_of_longs,
343 vector_of_doubles,
344 parent_namespace_test,
345 vector_of_referrables,
346 single_weak_reference,
347 vector_of_weak_references,
348 vector_of_strong_referrables,
349 co_owning_reference,
350 vector_of_co_owning_references,
351 non_owning_reference,
352 vector_of_non_owning_references,
353 any_unique,
354 any_ambiguous,
355 vector_of_enums,
356 signed_enum,
357 testrequirednestedflatbuffer,
358 scalar_key_sorted_tables,
359 native_inline,
360 long_enum_non_enum_default,
361 long_enum_normal_default,
362 }
363 }
364
365 #[inline]
pos(&self) -> Option<&'a Vec3>366 pub fn pos(&self) -> Option<&'a Vec3> {
367 self._tab.get::<Vec3>(Monster::VT_POS, None)
368 }
369 #[inline]
mana(&self) -> i16370 pub fn mana(&self) -> i16 {
371 self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()
372 }
373 #[inline]
hp(&self) -> i16374 pub fn hp(&self) -> i16 {
375 self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()
376 }
377 #[inline]
name(&self) -> &'a str378 pub fn name(&self) -> &'a str {
379 self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()
380 }
381 #[inline]
key_compare_less_than(&self, o: &Monster) -> bool382 pub fn key_compare_less_than(&self, o: &Monster) -> bool {
383 self.name() < o.name()
384 }
385
386 #[inline]
key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering387 pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering {
388 let key = self.name();
389 key.cmp(val)
390 }
391 #[inline]
inventory(&self) -> Option<&'a [u8]>392 pub fn inventory(&self) -> Option<&'a [u8]> {
393 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None).map(|v| v.safe_slice())
394 }
395 #[inline]
color(&self) -> Color396 pub fn color(&self) -> Color {
397 self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()
398 }
399 #[inline]
test_type(&self) -> Any400 pub fn test_type(&self) -> Any {
401 self._tab.get::<Any>(Monster::VT_TEST_TYPE, Some(Any::NONE)).unwrap()
402 }
403 #[inline]
test(&self) -> Option<flatbuffers::Table<'a>>404 pub fn test(&self) -> Option<flatbuffers::Table<'a>> {
405 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_TEST, None)
406 }
407 #[inline]
test4(&self) -> Option<&'a [Test]>408 pub fn test4(&self) -> Option<&'a [Test]> {
409 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST4, None).map(|v| v.safe_slice())
410 }
411 #[inline]
testarrayofstring(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>412 pub fn testarrayofstring(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
413 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING, None)
414 }
415 /// an example documentation comment: this will end up in the generated code
416 /// multiline too
417 #[inline]
testarrayoftables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>>418 pub fn testarrayoftables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>> {
419 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster>>>>(Monster::VT_TESTARRAYOFTABLES, None)
420 }
421 #[inline]
enemy(&self) -> Option<Monster<'a>>422 pub fn enemy(&self) -> Option<Monster<'a>> {
423 self._tab.get::<flatbuffers::ForwardsUOffset<Monster>>(Monster::VT_ENEMY, None)
424 }
425 #[inline]
testnestedflatbuffer(&self) -> Option<&'a [u8]>426 pub fn testnestedflatbuffer(&self) -> Option<&'a [u8]> {
427 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
428 }
testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>>429 pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
430 self.testnestedflatbuffer().map(|data| {
431 use flatbuffers::Follow;
432 <flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0)
433 })
434 }
435 #[inline]
testempty(&self) -> Option<Stat<'a>>436 pub fn testempty(&self) -> Option<Stat<'a>> {
437 self._tab.get::<flatbuffers::ForwardsUOffset<Stat>>(Monster::VT_TESTEMPTY, None)
438 }
439 #[inline]
testbool(&self) -> bool440 pub fn testbool(&self) -> bool {
441 self._tab.get::<bool>(Monster::VT_TESTBOOL, Some(false)).unwrap()
442 }
443 #[inline]
testhashs32_fnv1(&self) -> i32444 pub fn testhashs32_fnv1(&self) -> i32 {
445 self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1, Some(0)).unwrap()
446 }
447 #[inline]
testhashu32_fnv1(&self) -> u32448 pub fn testhashu32_fnv1(&self) -> u32 {
449 self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1, Some(0)).unwrap()
450 }
451 #[inline]
testhashs64_fnv1(&self) -> i64452 pub fn testhashs64_fnv1(&self) -> i64 {
453 self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1, Some(0)).unwrap()
454 }
455 #[inline]
testhashu64_fnv1(&self) -> u64456 pub fn testhashu64_fnv1(&self) -> u64 {
457 self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1, Some(0)).unwrap()
458 }
459 #[inline]
testhashs32_fnv1a(&self) -> i32460 pub fn testhashs32_fnv1a(&self) -> i32 {
461 self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1A, Some(0)).unwrap()
462 }
463 #[inline]
testhashu32_fnv1a(&self) -> u32464 pub fn testhashu32_fnv1a(&self) -> u32 {
465 self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1A, Some(0)).unwrap()
466 }
467 #[inline]
testhashs64_fnv1a(&self) -> i64468 pub fn testhashs64_fnv1a(&self) -> i64 {
469 self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1A, Some(0)).unwrap()
470 }
471 #[inline]
testhashu64_fnv1a(&self) -> u64472 pub fn testhashu64_fnv1a(&self) -> u64 {
473 self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1A, Some(0)).unwrap()
474 }
475 #[inline]
testarrayofbools(&self) -> Option<&'a [bool]>476 pub fn testarrayofbools(&self) -> Option<&'a [bool]> {
477 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, bool>>>(Monster::VT_TESTARRAYOFBOOLS, None).map(|v| v.safe_slice())
478 }
479 #[inline]
testf(&self) -> f32480 pub fn testf(&self) -> f32 {
481 self._tab.get::<f32>(Monster::VT_TESTF, Some(3.14159)).unwrap()
482 }
483 #[inline]
testf2(&self) -> f32484 pub fn testf2(&self) -> f32 {
485 self._tab.get::<f32>(Monster::VT_TESTF2, Some(3.0)).unwrap()
486 }
487 #[inline]
testf3(&self) -> f32488 pub fn testf3(&self) -> f32 {
489 self._tab.get::<f32>(Monster::VT_TESTF3, Some(0.0)).unwrap()
490 }
491 #[inline]
testarrayofstring2(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>492 pub fn testarrayofstring2(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
493 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING2, None)
494 }
495 #[inline]
testarrayofsortedstruct(&self) -> Option<&'a [Ability]>496 pub fn testarrayofsortedstruct(&self) -> Option<&'a [Ability]> {
497 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Ability>>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, None).map(|v| v.safe_slice())
498 }
499 #[inline]
flex(&self) -> Option<&'a [u8]>500 pub fn flex(&self) -> Option<&'a [u8]> {
501 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_FLEX, None).map(|v| v.safe_slice())
502 }
503 #[inline]
test5(&self) -> Option<&'a [Test]>504 pub fn test5(&self) -> Option<&'a [Test]> {
505 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST5, None).map(|v| v.safe_slice())
506 }
507 #[inline]
vector_of_longs(&self) -> Option<flatbuffers::Vector<'a, i64>>508 pub fn vector_of_longs(&self) -> Option<flatbuffers::Vector<'a, i64>> {
509 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i64>>>(Monster::VT_VECTOR_OF_LONGS, None)
510 }
511 #[inline]
vector_of_doubles(&self) -> Option<flatbuffers::Vector<'a, f64>>512 pub fn vector_of_doubles(&self) -> Option<flatbuffers::Vector<'a, f64>> {
513 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Monster::VT_VECTOR_OF_DOUBLES, None)
514 }
515 #[inline]
parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>>516 pub fn parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>> {
517 self._tab.get::<flatbuffers::ForwardsUOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, None)
518 }
519 #[inline]
vector_of_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>520 pub fn vector_of_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
521 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None)
522 }
523 #[inline]
single_weak_reference(&self) -> u64524 pub fn single_weak_reference(&self) -> u64 {
525 self._tab.get::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, Some(0)).unwrap()
526 }
527 #[inline]
vector_of_weak_references(&self) -> Option<flatbuffers::Vector<'a, u64>>528 pub fn vector_of_weak_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
529 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None)
530 }
531 #[inline]
vector_of_strong_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>532 pub fn vector_of_strong_referrables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
533 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None)
534 }
535 #[inline]
co_owning_reference(&self) -> u64536 pub fn co_owning_reference(&self) -> u64 {
537 self._tab.get::<u64>(Monster::VT_CO_OWNING_REFERENCE, Some(0)).unwrap()
538 }
539 #[inline]
vector_of_co_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>>540 pub fn vector_of_co_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
541 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, None)
542 }
543 #[inline]
non_owning_reference(&self) -> u64544 pub fn non_owning_reference(&self) -> u64 {
545 self._tab.get::<u64>(Monster::VT_NON_OWNING_REFERENCE, Some(0)).unwrap()
546 }
547 #[inline]
vector_of_non_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>>548 pub fn vector_of_non_owning_references(&self) -> Option<flatbuffers::Vector<'a, u64>> {
549 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)
550 }
551 #[inline]
any_unique_type(&self) -> AnyUniqueAliases552 pub fn any_unique_type(&self) -> AnyUniqueAliases {
553 self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()
554 }
555 #[inline]
any_unique(&self) -> Option<flatbuffers::Table<'a>>556 pub fn any_unique(&self) -> Option<flatbuffers::Table<'a>> {
557 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)
558 }
559 #[inline]
any_ambiguous_type(&self) -> AnyAmbiguousAliases560 pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases {
561 self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()
562 }
563 #[inline]
any_ambiguous(&self) -> Option<flatbuffers::Table<'a>>564 pub fn any_ambiguous(&self) -> Option<flatbuffers::Table<'a>> {
565 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)
566 }
567 #[inline]
vector_of_enums(&self) -> Option<flatbuffers::Vector<'a, Color>>568 pub fn vector_of_enums(&self) -> Option<flatbuffers::Vector<'a, Color>> {
569 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)
570 }
571 #[inline]
signed_enum(&self) -> Race572 pub fn signed_enum(&self) -> Race {
573 self._tab.get::<Race>(Monster::VT_SIGNED_ENUM, Some(Race::None)).unwrap()
574 }
575 #[inline]
testrequirednestedflatbuffer(&self) -> Option<&'a [u8]>576 pub fn testrequirednestedflatbuffer(&self) -> Option<&'a [u8]> {
577 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
578 }
testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>>579 pub fn testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
580 self.testrequirednestedflatbuffer().map(|data| {
581 use flatbuffers::Follow;
582 <flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0)
583 })
584 }
585 #[inline]
scalar_key_sorted_tables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat<'a>>>>586 pub fn scalar_key_sorted_tables(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat<'a>>>> {
587 self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat>>>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, None)
588 }
589 #[inline]
native_inline(&self) -> Option<&'a Test>590 pub fn native_inline(&self) -> Option<&'a Test> {
591 self._tab.get::<Test>(Monster::VT_NATIVE_INLINE, None)
592 }
593 #[inline]
long_enum_non_enum_default(&self) -> LongEnum594 pub fn long_enum_non_enum_default(&self) -> LongEnum {
595 self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, Some(Default::default())).unwrap()
596 }
597 #[inline]
long_enum_normal_default(&self) -> LongEnum598 pub fn long_enum_normal_default(&self) -> LongEnum {
599 self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, Some(LongEnum::LongOne)).unwrap()
600 }
601 #[inline]
602 #[allow(non_snake_case)]
test_as_monster(&self) -> Option<Monster<'a>>603 pub fn test_as_monster(&self) -> Option<Monster<'a>> {
604 if self.test_type() == Any::Monster {
605 self.test().map(Monster::init_from_table)
606 } else {
607 None
608 }
609 }
610
611 #[inline]
612 #[allow(non_snake_case)]
test_as_test_simple_table_with_enum(&self) -> Option<TestSimpleTableWithEnum<'a>>613 pub fn test_as_test_simple_table_with_enum(&self) -> Option<TestSimpleTableWithEnum<'a>> {
614 if self.test_type() == Any::TestSimpleTableWithEnum {
615 self.test().map(TestSimpleTableWithEnum::init_from_table)
616 } else {
617 None
618 }
619 }
620
621 #[inline]
622 #[allow(non_snake_case)]
test_as_my_game_example_2_monster(&self) -> Option<super::example_2::Monster<'a>>623 pub fn test_as_my_game_example_2_monster(&self) -> Option<super::example_2::Monster<'a>> {
624 if self.test_type() == Any::MyGame_Example2_Monster {
625 self.test().map(super::example_2::Monster::init_from_table)
626 } else {
627 None
628 }
629 }
630
631 #[inline]
632 #[allow(non_snake_case)]
any_unique_as_m(&self) -> Option<Monster<'a>>633 pub fn any_unique_as_m(&self) -> Option<Monster<'a>> {
634 if self.any_unique_type() == AnyUniqueAliases::M {
635 self.any_unique().map(Monster::init_from_table)
636 } else {
637 None
638 }
639 }
640
641 #[inline]
642 #[allow(non_snake_case)]
any_unique_as_ts(&self) -> Option<TestSimpleTableWithEnum<'a>>643 pub fn any_unique_as_ts(&self) -> Option<TestSimpleTableWithEnum<'a>> {
644 if self.any_unique_type() == AnyUniqueAliases::TS {
645 self.any_unique().map(TestSimpleTableWithEnum::init_from_table)
646 } else {
647 None
648 }
649 }
650
651 #[inline]
652 #[allow(non_snake_case)]
any_unique_as_m2(&self) -> Option<super::example_2::Monster<'a>>653 pub fn any_unique_as_m2(&self) -> Option<super::example_2::Monster<'a>> {
654 if self.any_unique_type() == AnyUniqueAliases::M2 {
655 self.any_unique().map(super::example_2::Monster::init_from_table)
656 } else {
657 None
658 }
659 }
660
661 #[inline]
662 #[allow(non_snake_case)]
any_ambiguous_as_m1(&self) -> Option<Monster<'a>>663 pub fn any_ambiguous_as_m1(&self) -> Option<Monster<'a>> {
664 if self.any_ambiguous_type() == AnyAmbiguousAliases::M1 {
665 self.any_ambiguous().map(Monster::init_from_table)
666 } else {
667 None
668 }
669 }
670
671 #[inline]
672 #[allow(non_snake_case)]
any_ambiguous_as_m2(&self) -> Option<Monster<'a>>673 pub fn any_ambiguous_as_m2(&self) -> Option<Monster<'a>> {
674 if self.any_ambiguous_type() == AnyAmbiguousAliases::M2 {
675 self.any_ambiguous().map(Monster::init_from_table)
676 } else {
677 None
678 }
679 }
680
681 #[inline]
682 #[allow(non_snake_case)]
any_ambiguous_as_m3(&self) -> Option<Monster<'a>>683 pub fn any_ambiguous_as_m3(&self) -> Option<Monster<'a>> {
684 if self.any_ambiguous_type() == AnyAmbiguousAliases::M3 {
685 self.any_ambiguous().map(Monster::init_from_table)
686 } else {
687 None
688 }
689 }
690
691 }
692
693 impl flatbuffers::Verifiable for Monster<'_> {
694 #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>695 fn run_verifier(
696 v: &mut flatbuffers::Verifier, pos: usize
697 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
698 use self::flatbuffers::Verifiable;
699 v.visit_table(pos)?
700 .visit_field::<Vec3>("pos", Self::VT_POS, false)?
701 .visit_field::<i16>("mana", Self::VT_MANA, false)?
702 .visit_field::<i16>("hp", Self::VT_HP, false)?
703 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, true)?
704 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("inventory", Self::VT_INVENTORY, false)?
705 .visit_field::<Color>("color", Self::VT_COLOR, false)?
706 .visit_union::<Any, _>("test_type", Self::VT_TEST_TYPE, "test", Self::VT_TEST, false, |key, v, pos| {
707 match key {
708 Any::Monster => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("Any::Monster", pos),
709 Any::TestSimpleTableWithEnum => v.verify_union_variant::<flatbuffers::ForwardsUOffset<TestSimpleTableWithEnum>>("Any::TestSimpleTableWithEnum", pos),
710 Any::MyGame_Example2_Monster => v.verify_union_variant::<flatbuffers::ForwardsUOffset<super::example_2::Monster>>("Any::MyGame_Example2_Monster", pos),
711 _ => Ok(()),
712 }
713 })?
714 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Test>>>("test4", Self::VT_TEST4, false)?
715 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>>>("testarrayofstring", Self::VT_TESTARRAYOFSTRING, false)?
716 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Monster>>>>("testarrayoftables", Self::VT_TESTARRAYOFTABLES, false)?
717 .visit_field::<flatbuffers::ForwardsUOffset<Monster>>("enemy", Self::VT_ENEMY, false)?
718 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("testnestedflatbuffer", Self::VT_TESTNESTEDFLATBUFFER, false)?
719 .visit_field::<flatbuffers::ForwardsUOffset<Stat>>("testempty", Self::VT_TESTEMPTY, false)?
720 .visit_field::<bool>("testbool", Self::VT_TESTBOOL, false)?
721 .visit_field::<i32>("testhashs32_fnv1", Self::VT_TESTHASHS32_FNV1, false)?
722 .visit_field::<u32>("testhashu32_fnv1", Self::VT_TESTHASHU32_FNV1, false)?
723 .visit_field::<i64>("testhashs64_fnv1", Self::VT_TESTHASHS64_FNV1, false)?
724 .visit_field::<u64>("testhashu64_fnv1", Self::VT_TESTHASHU64_FNV1, false)?
725 .visit_field::<i32>("testhashs32_fnv1a", Self::VT_TESTHASHS32_FNV1A, false)?
726 .visit_field::<u32>("testhashu32_fnv1a", Self::VT_TESTHASHU32_FNV1A, false)?
727 .visit_field::<i64>("testhashs64_fnv1a", Self::VT_TESTHASHS64_FNV1A, false)?
728 .visit_field::<u64>("testhashu64_fnv1a", Self::VT_TESTHASHU64_FNV1A, false)?
729 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, bool>>>("testarrayofbools", Self::VT_TESTARRAYOFBOOLS, false)?
730 .visit_field::<f32>("testf", Self::VT_TESTF, false)?
731 .visit_field::<f32>("testf2", Self::VT_TESTF2, false)?
732 .visit_field::<f32>("testf3", Self::VT_TESTF3, false)?
733 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>>>("testarrayofstring2", Self::VT_TESTARRAYOFSTRING2, false)?
734 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Ability>>>("testarrayofsortedstruct", Self::VT_TESTARRAYOFSORTEDSTRUCT, false)?
735 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("flex", Self::VT_FLEX, false)?
736 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Test>>>("test5", Self::VT_TEST5, false)?
737 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i64>>>("vector_of_longs", Self::VT_VECTOR_OF_LONGS, false)?
738 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("vector_of_doubles", Self::VT_VECTOR_OF_DOUBLES, false)?
739 .visit_field::<flatbuffers::ForwardsUOffset<super::InParentNamespace>>("parent_namespace_test", Self::VT_PARENT_NAMESPACE_TEST, false)?
740 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Referrable>>>>("vector_of_referrables", Self::VT_VECTOR_OF_REFERRABLES, false)?
741 .visit_field::<u64>("single_weak_reference", Self::VT_SINGLE_WEAK_REFERENCE, false)?
742 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("vector_of_weak_references", Self::VT_VECTOR_OF_WEAK_REFERENCES, false)?
743 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Referrable>>>>("vector_of_strong_referrables", Self::VT_VECTOR_OF_STRONG_REFERRABLES, false)?
744 .visit_field::<u64>("co_owning_reference", Self::VT_CO_OWNING_REFERENCE, false)?
745 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("vector_of_co_owning_references", Self::VT_VECTOR_OF_CO_OWNING_REFERENCES, false)?
746 .visit_field::<u64>("non_owning_reference", Self::VT_NON_OWNING_REFERENCE, false)?
747 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("vector_of_non_owning_references", Self::VT_VECTOR_OF_NON_OWNING_REFERENCES, false)?
748 .visit_union::<AnyUniqueAliases, _>("any_unique_type", Self::VT_ANY_UNIQUE_TYPE, "any_unique", Self::VT_ANY_UNIQUE, false, |key, v, pos| {
749 match key {
750 AnyUniqueAliases::M => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyUniqueAliases::M", pos),
751 AnyUniqueAliases::TS => v.verify_union_variant::<flatbuffers::ForwardsUOffset<TestSimpleTableWithEnum>>("AnyUniqueAliases::TS", pos),
752 AnyUniqueAliases::M2 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<super::example_2::Monster>>("AnyUniqueAliases::M2", pos),
753 _ => Ok(()),
754 }
755 })?
756 .visit_union::<AnyAmbiguousAliases, _>("any_ambiguous_type", Self::VT_ANY_AMBIGUOUS_TYPE, "any_ambiguous", Self::VT_ANY_AMBIGUOUS, false, |key, v, pos| {
757 match key {
758 AnyAmbiguousAliases::M1 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyAmbiguousAliases::M1", pos),
759 AnyAmbiguousAliases::M2 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyAmbiguousAliases::M2", pos),
760 AnyAmbiguousAliases::M3 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Monster>>("AnyAmbiguousAliases::M3", pos),
761 _ => Ok(()),
762 }
763 })?
764 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Color>>>("vector_of_enums", Self::VT_VECTOR_OF_ENUMS, false)?
765 .visit_field::<Race>("signed_enum", Self::VT_SIGNED_ENUM, false)?
766 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("testrequirednestedflatbuffer", Self::VT_TESTREQUIREDNESTEDFLATBUFFER, false)?
767 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Stat>>>>("scalar_key_sorted_tables", Self::VT_SCALAR_KEY_SORTED_TABLES, false)?
768 .visit_field::<Test>("native_inline", Self::VT_NATIVE_INLINE, false)?
769 .visit_field::<LongEnum>("long_enum_non_enum_default", Self::VT_LONG_ENUM_NON_ENUM_DEFAULT, false)?
770 .visit_field::<LongEnum>("long_enum_normal_default", Self::VT_LONG_ENUM_NORMAL_DEFAULT, false)?
771 .finish();
772 Ok(())
773 }
774 }
775 pub struct MonsterArgs<'a> {
776 pub pos: Option<&'a Vec3>,
777 pub mana: i16,
778 pub hp: i16,
779 pub name: Option<flatbuffers::WIPOffset<&'a str>>,
780 pub inventory: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
781 pub color: Color,
782 pub test_type: Any,
783 pub test: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
784 pub test4: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Test>>>,
785 pub testarrayofstring: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
786 pub testarrayoftables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>>>,
787 pub enemy: Option<flatbuffers::WIPOffset<Monster<'a>>>,
788 pub testnestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
789 pub testempty: Option<flatbuffers::WIPOffset<Stat<'a>>>,
790 pub testbool: bool,
791 pub testhashs32_fnv1: i32,
792 pub testhashu32_fnv1: u32,
793 pub testhashs64_fnv1: i64,
794 pub testhashu64_fnv1: u64,
795 pub testhashs32_fnv1a: i32,
796 pub testhashu32_fnv1a: u32,
797 pub testhashs64_fnv1a: i64,
798 pub testhashu64_fnv1a: u64,
799 pub testarrayofbools: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, bool>>>,
800 pub testf: f32,
801 pub testf2: f32,
802 pub testf3: f32,
803 pub testarrayofstring2: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
804 pub testarrayofsortedstruct: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Ability>>>,
805 pub flex: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
806 pub test5: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Test>>>,
807 pub vector_of_longs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i64>>>,
808 pub vector_of_doubles: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
809 pub parent_namespace_test: Option<flatbuffers::WIPOffset<super::InParentNamespace<'a>>>,
810 pub vector_of_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>>,
811 pub single_weak_reference: u64,
812 pub vector_of_weak_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
813 pub vector_of_strong_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>>,
814 pub co_owning_reference: u64,
815 pub vector_of_co_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
816 pub non_owning_reference: u64,
817 pub vector_of_non_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
818 pub any_unique_type: AnyUniqueAliases,
819 pub any_unique: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
820 pub any_ambiguous_type: AnyAmbiguousAliases,
821 pub any_ambiguous: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
822 pub vector_of_enums: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Color>>>,
823 pub signed_enum: Race,
824 pub testrequirednestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
825 pub scalar_key_sorted_tables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Stat<'a>>>>>,
826 pub native_inline: Option<&'a Test>,
827 pub long_enum_non_enum_default: LongEnum,
828 pub long_enum_normal_default: LongEnum,
829 }
830 impl<'a> Default for MonsterArgs<'a> {
831 #[inline]
default() -> Self832 fn default() -> Self {
833 MonsterArgs {
834 pos: None,
835 mana: 150,
836 hp: 100,
837 name: None, // required field
838 inventory: None,
839 color: Color::Blue,
840 test_type: Any::NONE,
841 test: None,
842 test4: None,
843 testarrayofstring: None,
844 testarrayoftables: None,
845 enemy: None,
846 testnestedflatbuffer: None,
847 testempty: None,
848 testbool: false,
849 testhashs32_fnv1: 0,
850 testhashu32_fnv1: 0,
851 testhashs64_fnv1: 0,
852 testhashu64_fnv1: 0,
853 testhashs32_fnv1a: 0,
854 testhashu32_fnv1a: 0,
855 testhashs64_fnv1a: 0,
856 testhashu64_fnv1a: 0,
857 testarrayofbools: None,
858 testf: 3.14159,
859 testf2: 3.0,
860 testf3: 0.0,
861 testarrayofstring2: None,
862 testarrayofsortedstruct: None,
863 flex: None,
864 test5: None,
865 vector_of_longs: None,
866 vector_of_doubles: None,
867 parent_namespace_test: None,
868 vector_of_referrables: None,
869 single_weak_reference: 0,
870 vector_of_weak_references: None,
871 vector_of_strong_referrables: None,
872 co_owning_reference: 0,
873 vector_of_co_owning_references: None,
874 non_owning_reference: 0,
875 vector_of_non_owning_references: None,
876 any_unique_type: AnyUniqueAliases::NONE,
877 any_unique: None,
878 any_ambiguous_type: AnyAmbiguousAliases::NONE,
879 any_ambiguous: None,
880 vector_of_enums: None,
881 signed_enum: Race::None,
882 testrequirednestedflatbuffer: None,
883 scalar_key_sorted_tables: None,
884 native_inline: None,
885 long_enum_non_enum_default: Default::default(),
886 long_enum_normal_default: LongEnum::LongOne,
887 }
888 }
889 }
890
891 pub struct MonsterBuilder<'a: 'b, 'b> {
892 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
893 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
894 }
895 impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
896 #[inline]
add_pos(&mut self, pos: &Vec3)897 pub fn add_pos(&mut self, pos: &Vec3) {
898 self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
899 }
900 #[inline]
add_mana(&mut self, mana: i16)901 pub fn add_mana(&mut self, mana: i16) {
902 self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150);
903 }
904 #[inline]
add_hp(&mut self, hp: i16)905 pub fn add_hp(&mut self, hp: i16) {
906 self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
907 }
908 #[inline]
add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>)909 pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
910 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
911 }
912 #[inline]
add_inventory(&mut self, inventory: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)913 pub fn add_inventory(&mut self, inventory: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
914 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
915 }
916 #[inline]
add_color(&mut self, color: Color)917 pub fn add_color(&mut self, color: Color) {
918 self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
919 }
920 #[inline]
add_test_type(&mut self, test_type: Any)921 pub fn add_test_type(&mut self, test_type: Any) {
922 self.fbb_.push_slot::<Any>(Monster::VT_TEST_TYPE, test_type, Any::NONE);
923 }
924 #[inline]
add_test(&mut self, test: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>)925 pub fn add_test(&mut self, test: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
926 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST, test);
927 }
928 #[inline]
add_test4(&mut self, test4: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>)929 pub fn add_test4(&mut self, test4: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>) {
930 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST4, test4);
931 }
932 #[inline]
add_testarrayofstring(&mut self, testarrayofstring: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>)933 pub fn add_testarrayofstring(&mut self, testarrayofstring: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
934 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
935 }
936 #[inline]
add_testarrayoftables(&mut self, testarrayoftables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Monster<'b >>>>)937 pub fn add_testarrayoftables(&mut self, testarrayoftables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Monster<'b >>>>) {
938 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
939 }
940 #[inline]
add_enemy(&mut self, enemy: flatbuffers::WIPOffset<Monster<'b >>)941 pub fn add_enemy(&mut self, enemy: flatbuffers::WIPOffset<Monster<'b >>) {
942 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Monster>>(Monster::VT_ENEMY, enemy);
943 }
944 #[inline]
add_testnestedflatbuffer(&mut self, testnestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)945 pub fn add_testnestedflatbuffer(&mut self, testnestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
946 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
947 }
948 #[inline]
add_testempty(&mut self, testempty: flatbuffers::WIPOffset<Stat<'b >>)949 pub fn add_testempty(&mut self, testempty: flatbuffers::WIPOffset<Stat<'b >>) {
950 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Stat>>(Monster::VT_TESTEMPTY, testempty);
951 }
952 #[inline]
add_testbool(&mut self, testbool: bool)953 pub fn add_testbool(&mut self, testbool: bool) {
954 self.fbb_.push_slot::<bool>(Monster::VT_TESTBOOL, testbool, false);
955 }
956 #[inline]
add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32)957 pub fn add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32) {
958 self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
959 }
960 #[inline]
add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32)961 pub fn add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32) {
962 self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
963 }
964 #[inline]
add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64)965 pub fn add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64) {
966 self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
967 }
968 #[inline]
add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64)969 pub fn add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64) {
970 self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
971 }
972 #[inline]
add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32)973 pub fn add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32) {
974 self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
975 }
976 #[inline]
add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32)977 pub fn add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32) {
978 self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
979 }
980 #[inline]
add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64)981 pub fn add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64) {
982 self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
983 }
984 #[inline]
add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64)985 pub fn add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64) {
986 self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
987 }
988 #[inline]
add_testarrayofbools(&mut self, testarrayofbools: flatbuffers::WIPOffset<flatbuffers::Vector<'b , bool>>)989 pub fn add_testarrayofbools(&mut self, testarrayofbools: flatbuffers::WIPOffset<flatbuffers::Vector<'b , bool>>) {
990 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
991 }
992 #[inline]
add_testf(&mut self, testf: f32)993 pub fn add_testf(&mut self, testf: f32) {
994 self.fbb_.push_slot::<f32>(Monster::VT_TESTF, testf, 3.14159);
995 }
996 #[inline]
add_testf2(&mut self, testf2: f32)997 pub fn add_testf2(&mut self, testf2: f32) {
998 self.fbb_.push_slot::<f32>(Monster::VT_TESTF2, testf2, 3.0);
999 }
1000 #[inline]
add_testf3(&mut self, testf3: f32)1001 pub fn add_testf3(&mut self, testf3: f32) {
1002 self.fbb_.push_slot::<f32>(Monster::VT_TESTF3, testf3, 0.0);
1003 }
1004 #[inline]
add_testarrayofstring2(&mut self, testarrayofstring2: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>)1005 pub fn add_testarrayofstring2(&mut self, testarrayofstring2: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
1006 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
1007 }
1008 #[inline]
add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Ability>>)1009 pub fn add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Ability>>) {
1010 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
1011 }
1012 #[inline]
add_flex(&mut self, flex: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)1013 pub fn add_flex(&mut self, flex: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
1014 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_FLEX, flex);
1015 }
1016 #[inline]
add_test5(&mut self, test5: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>)1017 pub fn add_test5(&mut self, test5: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Test>>) {
1018 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TEST5, test5);
1019 }
1020 #[inline]
add_vector_of_longs(&mut self, vector_of_longs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i64>>)1021 pub fn add_vector_of_longs(&mut self, vector_of_longs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i64>>) {
1022 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
1023 }
1024 #[inline]
add_vector_of_doubles(&mut self, vector_of_doubles: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>)1025 pub fn add_vector_of_doubles(&mut self, vector_of_doubles: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
1026 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
1027 }
1028 #[inline]
add_parent_namespace_test(&mut self, parent_namespace_test: flatbuffers::WIPOffset<super::InParentNamespace<'b >>)1029 pub fn add_parent_namespace_test(&mut self, parent_namespace_test: flatbuffers::WIPOffset<super::InParentNamespace<'b >>) {
1030 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
1031 }
1032 #[inline]
add_vector_of_referrables(&mut self, vector_of_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>)1033 pub fn add_vector_of_referrables(&mut self, vector_of_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
1034 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
1035 }
1036 #[inline]
add_single_weak_reference(&mut self, single_weak_reference: u64)1037 pub fn add_single_weak_reference(&mut self, single_weak_reference: u64) {
1038 self.fbb_.push_slot::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
1039 }
1040 #[inline]
add_vector_of_weak_references(&mut self, vector_of_weak_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>)1041 pub fn add_vector_of_weak_references(&mut self, vector_of_weak_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
1042 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
1043 }
1044 #[inline]
add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>)1045 pub fn add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
1046 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
1047 }
1048 #[inline]
add_co_owning_reference(&mut self, co_owning_reference: u64)1049 pub fn add_co_owning_reference(&mut self, co_owning_reference: u64) {
1050 self.fbb_.push_slot::<u64>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
1051 }
1052 #[inline]
add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>)1053 pub fn add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
1054 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
1055 }
1056 #[inline]
add_non_owning_reference(&mut self, non_owning_reference: u64)1057 pub fn add_non_owning_reference(&mut self, non_owning_reference: u64) {
1058 self.fbb_.push_slot::<u64>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
1059 }
1060 #[inline]
add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>)1061 pub fn add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
1062 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
1063 }
1064 #[inline]
add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases)1065 pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) {
1066 self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE);
1067 }
1068 #[inline]
add_any_unique(&mut self, any_unique: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>)1069 pub fn add_any_unique(&mut self, any_unique: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
1070 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique);
1071 }
1072 #[inline]
add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases)1073 pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) {
1074 self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE);
1075 }
1076 #[inline]
add_any_ambiguous(&mut self, any_ambiguous: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>)1077 pub fn add_any_ambiguous(&mut self, any_ambiguous: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
1078 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
1079 }
1080 #[inline]
add_vector_of_enums(&mut self, vector_of_enums: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Color>>)1081 pub fn add_vector_of_enums(&mut self, vector_of_enums: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Color>>) {
1082 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
1083 }
1084 #[inline]
add_signed_enum(&mut self, signed_enum: Race)1085 pub fn add_signed_enum(&mut self, signed_enum: Race) {
1086 self.fbb_.push_slot::<Race>(Monster::VT_SIGNED_ENUM, signed_enum, Race::None);
1087 }
1088 #[inline]
add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>)1089 pub fn add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
1090 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
1091 }
1092 #[inline]
add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Stat<'b >>>>)1093 pub fn add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Stat<'b >>>>) {
1094 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
1095 }
1096 #[inline]
add_native_inline(&mut self, native_inline: &Test)1097 pub fn add_native_inline(&mut self, native_inline: &Test) {
1098 self.fbb_.push_slot_always::<&Test>(Monster::VT_NATIVE_INLINE, native_inline);
1099 }
1100 #[inline]
add_long_enum_non_enum_default(&mut self, long_enum_non_enum_default: LongEnum)1101 pub fn add_long_enum_non_enum_default(&mut self, long_enum_non_enum_default: LongEnum) {
1102 self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, long_enum_non_enum_default, Default::default());
1103 }
1104 #[inline]
add_long_enum_normal_default(&mut self, long_enum_normal_default: LongEnum)1105 pub fn add_long_enum_normal_default(&mut self, long_enum_normal_default: LongEnum) {
1106 self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, long_enum_normal_default, LongEnum::LongOne);
1107 }
1108 #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b>1109 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
1110 let start = _fbb.start_table();
1111 MonsterBuilder {
1112 fbb_: _fbb,
1113 start_: start,
1114 }
1115 }
1116 #[inline]
finish(self) -> flatbuffers::WIPOffset<Monster<'a>>1117 pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
1118 let o = self.fbb_.end_table(self.start_);
1119 self.fbb_.required(o, Monster::VT_NAME,"name");
1120 flatbuffers::WIPOffset::new(o.value())
1121 }
1122 }
1123
1124 impl core::fmt::Debug for Monster<'_> {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result1125 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1126 let mut ds = f.debug_struct("Monster");
1127 ds.field("pos", &self.pos());
1128 ds.field("mana", &self.mana());
1129 ds.field("hp", &self.hp());
1130 ds.field("name", &self.name());
1131 ds.field("inventory", &self.inventory());
1132 ds.field("color", &self.color());
1133 ds.field("test_type", &self.test_type());
1134 match self.test_type() {
1135 Any::Monster => {
1136 if let Some(x) = self.test_as_monster() {
1137 ds.field("test", &x)
1138 } else {
1139 ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
1140 }
1141 },
1142 Any::TestSimpleTableWithEnum => {
1143 if let Some(x) = self.test_as_test_simple_table_with_enum() {
1144 ds.field("test", &x)
1145 } else {
1146 ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
1147 }
1148 },
1149 Any::MyGame_Example2_Monster => {
1150 if let Some(x) = self.test_as_my_game_example_2_monster() {
1151 ds.field("test", &x)
1152 } else {
1153 ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
1154 }
1155 },
1156 _ => {
1157 let x: Option<()> = None;
1158 ds.field("test", &x)
1159 },
1160 };
1161 ds.field("test4", &self.test4());
1162 ds.field("testarrayofstring", &self.testarrayofstring());
1163 ds.field("testarrayoftables", &self.testarrayoftables());
1164 ds.field("enemy", &self.enemy());
1165 ds.field("testnestedflatbuffer", &self.testnestedflatbuffer());
1166 ds.field("testempty", &self.testempty());
1167 ds.field("testbool", &self.testbool());
1168 ds.field("testhashs32_fnv1", &self.testhashs32_fnv1());
1169 ds.field("testhashu32_fnv1", &self.testhashu32_fnv1());
1170 ds.field("testhashs64_fnv1", &self.testhashs64_fnv1());
1171 ds.field("testhashu64_fnv1", &self.testhashu64_fnv1());
1172 ds.field("testhashs32_fnv1a", &self.testhashs32_fnv1a());
1173 ds.field("testhashu32_fnv1a", &self.testhashu32_fnv1a());
1174 ds.field("testhashs64_fnv1a", &self.testhashs64_fnv1a());
1175 ds.field("testhashu64_fnv1a", &self.testhashu64_fnv1a());
1176 ds.field("testarrayofbools", &self.testarrayofbools());
1177 ds.field("testf", &self.testf());
1178 ds.field("testf2", &self.testf2());
1179 ds.field("testf3", &self.testf3());
1180 ds.field("testarrayofstring2", &self.testarrayofstring2());
1181 ds.field("testarrayofsortedstruct", &self.testarrayofsortedstruct());
1182 ds.field("flex", &self.flex());
1183 ds.field("test5", &self.test5());
1184 ds.field("vector_of_longs", &self.vector_of_longs());
1185 ds.field("vector_of_doubles", &self.vector_of_doubles());
1186 ds.field("parent_namespace_test", &self.parent_namespace_test());
1187 ds.field("vector_of_referrables", &self.vector_of_referrables());
1188 ds.field("single_weak_reference", &self.single_weak_reference());
1189 ds.field("vector_of_weak_references", &self.vector_of_weak_references());
1190 ds.field("vector_of_strong_referrables", &self.vector_of_strong_referrables());
1191 ds.field("co_owning_reference", &self.co_owning_reference());
1192 ds.field("vector_of_co_owning_references", &self.vector_of_co_owning_references());
1193 ds.field("non_owning_reference", &self.non_owning_reference());
1194 ds.field("vector_of_non_owning_references", &self.vector_of_non_owning_references());
1195 ds.field("any_unique_type", &self.any_unique_type());
1196 match self.any_unique_type() {
1197 AnyUniqueAliases::M => {
1198 if let Some(x) = self.any_unique_as_m() {
1199 ds.field("any_unique", &x)
1200 } else {
1201 ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
1202 }
1203 },
1204 AnyUniqueAliases::TS => {
1205 if let Some(x) = self.any_unique_as_ts() {
1206 ds.field("any_unique", &x)
1207 } else {
1208 ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
1209 }
1210 },
1211 AnyUniqueAliases::M2 => {
1212 if let Some(x) = self.any_unique_as_m2() {
1213 ds.field("any_unique", &x)
1214 } else {
1215 ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
1216 }
1217 },
1218 _ => {
1219 let x: Option<()> = None;
1220 ds.field("any_unique", &x)
1221 },
1222 };
1223 ds.field("any_ambiguous_type", &self.any_ambiguous_type());
1224 match self.any_ambiguous_type() {
1225 AnyAmbiguousAliases::M1 => {
1226 if let Some(x) = self.any_ambiguous_as_m1() {
1227 ds.field("any_ambiguous", &x)
1228 } else {
1229 ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
1230 }
1231 },
1232 AnyAmbiguousAliases::M2 => {
1233 if let Some(x) = self.any_ambiguous_as_m2() {
1234 ds.field("any_ambiguous", &x)
1235 } else {
1236 ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
1237 }
1238 },
1239 AnyAmbiguousAliases::M3 => {
1240 if let Some(x) = self.any_ambiguous_as_m3() {
1241 ds.field("any_ambiguous", &x)
1242 } else {
1243 ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
1244 }
1245 },
1246 _ => {
1247 let x: Option<()> = None;
1248 ds.field("any_ambiguous", &x)
1249 },
1250 };
1251 ds.field("vector_of_enums", &self.vector_of_enums());
1252 ds.field("signed_enum", &self.signed_enum());
1253 ds.field("testrequirednestedflatbuffer", &self.testrequirednestedflatbuffer());
1254 ds.field("scalar_key_sorted_tables", &self.scalar_key_sorted_tables());
1255 ds.field("native_inline", &self.native_inline());
1256 ds.field("long_enum_non_enum_default", &self.long_enum_non_enum_default());
1257 ds.field("long_enum_normal_default", &self.long_enum_normal_default());
1258 ds.finish()
1259 }
1260 }
1261 #[non_exhaustive]
1262 #[derive(Debug, Clone, PartialEq)]
1263 pub struct MonsterT {
1264 pub pos: Option<Vec3T>,
1265 pub mana: i16,
1266 pub hp: i16,
1267 pub name: String,
1268 pub inventory: Option<Vec<u8>>,
1269 pub color: Color,
1270 pub test: AnyT,
1271 pub test4: Option<Vec<TestT>>,
1272 pub testarrayofstring: Option<Vec<String>>,
1273 pub testarrayoftables: Option<Vec<MonsterT>>,
1274 pub enemy: Option<Box<MonsterT>>,
1275 pub testnestedflatbuffer: Option<Vec<u8>>,
1276 pub testempty: Option<Box<StatT>>,
1277 pub testbool: bool,
1278 pub testhashs32_fnv1: i32,
1279 pub testhashu32_fnv1: u32,
1280 pub testhashs64_fnv1: i64,
1281 pub testhashu64_fnv1: u64,
1282 pub testhashs32_fnv1a: i32,
1283 pub testhashu32_fnv1a: u32,
1284 pub testhashs64_fnv1a: i64,
1285 pub testhashu64_fnv1a: u64,
1286 pub testarrayofbools: Option<Vec<bool>>,
1287 pub testf: f32,
1288 pub testf2: f32,
1289 pub testf3: f32,
1290 pub testarrayofstring2: Option<Vec<String>>,
1291 pub testarrayofsortedstruct: Option<Vec<AbilityT>>,
1292 pub flex: Option<Vec<u8>>,
1293 pub test5: Option<Vec<TestT>>,
1294 pub vector_of_longs: Option<Vec<i64>>,
1295 pub vector_of_doubles: Option<Vec<f64>>,
1296 pub parent_namespace_test: Option<Box<super::InParentNamespaceT>>,
1297 pub vector_of_referrables: Option<Vec<ReferrableT>>,
1298 pub single_weak_reference: u64,
1299 pub vector_of_weak_references: Option<Vec<u64>>,
1300 pub vector_of_strong_referrables: Option<Vec<ReferrableT>>,
1301 pub co_owning_reference: u64,
1302 pub vector_of_co_owning_references: Option<Vec<u64>>,
1303 pub non_owning_reference: u64,
1304 pub vector_of_non_owning_references: Option<Vec<u64>>,
1305 pub any_unique: AnyUniqueAliasesT,
1306 pub any_ambiguous: AnyAmbiguousAliasesT,
1307 pub vector_of_enums: Option<Vec<Color>>,
1308 pub signed_enum: Race,
1309 pub testrequirednestedflatbuffer: Option<Vec<u8>>,
1310 pub scalar_key_sorted_tables: Option<Vec<StatT>>,
1311 pub native_inline: Option<TestT>,
1312 pub long_enum_non_enum_default: LongEnum,
1313 pub long_enum_normal_default: LongEnum,
1314 }
1315 impl Default for MonsterT {
default() -> Self1316 fn default() -> Self {
1317 Self {
1318 pos: None,
1319 mana: 150,
1320 hp: 100,
1321 name: "".to_string(),
1322 inventory: None,
1323 color: Color::Blue,
1324 test: AnyT::NONE,
1325 test4: None,
1326 testarrayofstring: None,
1327 testarrayoftables: None,
1328 enemy: None,
1329 testnestedflatbuffer: None,
1330 testempty: None,
1331 testbool: false,
1332 testhashs32_fnv1: 0,
1333 testhashu32_fnv1: 0,
1334 testhashs64_fnv1: 0,
1335 testhashu64_fnv1: 0,
1336 testhashs32_fnv1a: 0,
1337 testhashu32_fnv1a: 0,
1338 testhashs64_fnv1a: 0,
1339 testhashu64_fnv1a: 0,
1340 testarrayofbools: None,
1341 testf: 3.14159,
1342 testf2: 3.0,
1343 testf3: 0.0,
1344 testarrayofstring2: None,
1345 testarrayofsortedstruct: None,
1346 flex: None,
1347 test5: None,
1348 vector_of_longs: None,
1349 vector_of_doubles: None,
1350 parent_namespace_test: None,
1351 vector_of_referrables: None,
1352 single_weak_reference: 0,
1353 vector_of_weak_references: None,
1354 vector_of_strong_referrables: None,
1355 co_owning_reference: 0,
1356 vector_of_co_owning_references: None,
1357 non_owning_reference: 0,
1358 vector_of_non_owning_references: None,
1359 any_unique: AnyUniqueAliasesT::NONE,
1360 any_ambiguous: AnyAmbiguousAliasesT::NONE,
1361 vector_of_enums: None,
1362 signed_enum: Race::None,
1363 testrequirednestedflatbuffer: None,
1364 scalar_key_sorted_tables: None,
1365 native_inline: None,
1366 long_enum_non_enum_default: Default::default(),
1367 long_enum_normal_default: LongEnum::LongOne,
1368 }
1369 }
1370 }
1371 impl MonsterT {
pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<Monster<'b>>1372 pub fn pack<'b>(
1373 &self,
1374 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
1375 ) -> flatbuffers::WIPOffset<Monster<'b>> {
1376 let pos_tmp = self.pos.as_ref().map(|x| x.pack());
1377 let pos = pos_tmp.as_ref();
1378 let mana = self.mana;
1379 let hp = self.hp;
1380 let name = Some({
1381 let x = &self.name;
1382 _fbb.create_string(x)
1383 });
1384 let inventory = self.inventory.as_ref().map(|x|{
1385 _fbb.create_vector(x)
1386 });
1387 let color = self.color;
1388 let test_type = self.test.any_type();
1389 let test = self.test.pack(_fbb);
1390 let test4 = self.test4.as_ref().map(|x|{
1391 let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
1392 });
1393 let testarrayofstring = self.testarrayofstring.as_ref().map(|x|{
1394 let w: Vec<_> = x.iter().map(|s| s.as_ref()).collect();_fbb.create_vector_of_strings(&w)
1395 });
1396 let testarrayoftables = self.testarrayoftables.as_ref().map(|x|{
1397 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
1398 });
1399 let enemy = self.enemy.as_ref().map(|x|{
1400 x.pack(_fbb)
1401 });
1402 let testnestedflatbuffer = self.testnestedflatbuffer.as_ref().map(|x|{
1403 _fbb.create_vector(x)
1404 });
1405 let testempty = self.testempty.as_ref().map(|x|{
1406 x.pack(_fbb)
1407 });
1408 let testbool = self.testbool;
1409 let testhashs32_fnv1 = self.testhashs32_fnv1;
1410 let testhashu32_fnv1 = self.testhashu32_fnv1;
1411 let testhashs64_fnv1 = self.testhashs64_fnv1;
1412 let testhashu64_fnv1 = self.testhashu64_fnv1;
1413 let testhashs32_fnv1a = self.testhashs32_fnv1a;
1414 let testhashu32_fnv1a = self.testhashu32_fnv1a;
1415 let testhashs64_fnv1a = self.testhashs64_fnv1a;
1416 let testhashu64_fnv1a = self.testhashu64_fnv1a;
1417 let testarrayofbools = self.testarrayofbools.as_ref().map(|x|{
1418 _fbb.create_vector(x)
1419 });
1420 let testf = self.testf;
1421 let testf2 = self.testf2;
1422 let testf3 = self.testf3;
1423 let testarrayofstring2 = self.testarrayofstring2.as_ref().map(|x|{
1424 let w: Vec<_> = x.iter().map(|s| s.as_ref()).collect();_fbb.create_vector_of_strings(&w)
1425 });
1426 let testarrayofsortedstruct = self.testarrayofsortedstruct.as_ref().map(|x|{
1427 let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
1428 });
1429 let flex = self.flex.as_ref().map(|x|{
1430 _fbb.create_vector(x)
1431 });
1432 let test5 = self.test5.as_ref().map(|x|{
1433 let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
1434 });
1435 let vector_of_longs = self.vector_of_longs.as_ref().map(|x|{
1436 _fbb.create_vector(x)
1437 });
1438 let vector_of_doubles = self.vector_of_doubles.as_ref().map(|x|{
1439 _fbb.create_vector(x)
1440 });
1441 let parent_namespace_test = self.parent_namespace_test.as_ref().map(|x|{
1442 x.pack(_fbb)
1443 });
1444 let vector_of_referrables = self.vector_of_referrables.as_ref().map(|x|{
1445 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
1446 });
1447 let single_weak_reference = self.single_weak_reference;
1448 let vector_of_weak_references = self.vector_of_weak_references.as_ref().map(|x|{
1449 _fbb.create_vector(x)
1450 });
1451 let vector_of_strong_referrables = self.vector_of_strong_referrables.as_ref().map(|x|{
1452 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
1453 });
1454 let co_owning_reference = self.co_owning_reference;
1455 let vector_of_co_owning_references = self.vector_of_co_owning_references.as_ref().map(|x|{
1456 _fbb.create_vector(x)
1457 });
1458 let non_owning_reference = self.non_owning_reference;
1459 let vector_of_non_owning_references = self.vector_of_non_owning_references.as_ref().map(|x|{
1460 _fbb.create_vector(x)
1461 });
1462 let any_unique_type = self.any_unique.any_unique_aliases_type();
1463 let any_unique = self.any_unique.pack(_fbb);
1464 let any_ambiguous_type = self.any_ambiguous.any_ambiguous_aliases_type();
1465 let any_ambiguous = self.any_ambiguous.pack(_fbb);
1466 let vector_of_enums = self.vector_of_enums.as_ref().map(|x|{
1467 _fbb.create_vector(x)
1468 });
1469 let signed_enum = self.signed_enum;
1470 let testrequirednestedflatbuffer = self.testrequirednestedflatbuffer.as_ref().map(|x|{
1471 _fbb.create_vector(x)
1472 });
1473 let scalar_key_sorted_tables = self.scalar_key_sorted_tables.as_ref().map(|x|{
1474 let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
1475 });
1476 let native_inline_tmp = self.native_inline.as_ref().map(|x| x.pack());
1477 let native_inline = native_inline_tmp.as_ref();
1478 let long_enum_non_enum_default = self.long_enum_non_enum_default;
1479 let long_enum_normal_default = self.long_enum_normal_default;
1480 Monster::create(_fbb, &MonsterArgs{
1481 pos,
1482 mana,
1483 hp,
1484 name,
1485 inventory,
1486 color,
1487 test_type,
1488 test,
1489 test4,
1490 testarrayofstring,
1491 testarrayoftables,
1492 enemy,
1493 testnestedflatbuffer,
1494 testempty,
1495 testbool,
1496 testhashs32_fnv1,
1497 testhashu32_fnv1,
1498 testhashs64_fnv1,
1499 testhashu64_fnv1,
1500 testhashs32_fnv1a,
1501 testhashu32_fnv1a,
1502 testhashs64_fnv1a,
1503 testhashu64_fnv1a,
1504 testarrayofbools,
1505 testf,
1506 testf2,
1507 testf3,
1508 testarrayofstring2,
1509 testarrayofsortedstruct,
1510 flex,
1511 test5,
1512 vector_of_longs,
1513 vector_of_doubles,
1514 parent_namespace_test,
1515 vector_of_referrables,
1516 single_weak_reference,
1517 vector_of_weak_references,
1518 vector_of_strong_referrables,
1519 co_owning_reference,
1520 vector_of_co_owning_references,
1521 non_owning_reference,
1522 vector_of_non_owning_references,
1523 any_unique_type,
1524 any_unique,
1525 any_ambiguous_type,
1526 any_ambiguous,
1527 vector_of_enums,
1528 signed_enum,
1529 testrequirednestedflatbuffer,
1530 scalar_key_sorted_tables,
1531 native_inline,
1532 long_enum_non_enum_default,
1533 long_enum_normal_default,
1534 })
1535 }
1536 }
1537 #[inline]
1538 #[deprecated(since="2.0.0", note="Deprecated in favor of `root_as...` methods.")]
get_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a>1539 pub fn get_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
1540 unsafe { flatbuffers::root_unchecked::<Monster<'a>>(buf) }
1541 }
1542
1543 #[inline]
1544 #[deprecated(since="2.0.0", note="Deprecated in favor of `root_as...` methods.")]
get_size_prefixed_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a>1545 pub fn get_size_prefixed_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
1546 unsafe { flatbuffers::size_prefixed_root_unchecked::<Monster<'a>>(buf) }
1547 }
1548
1549 #[inline]
1550 /// Verifies that a buffer of bytes contains a `Monster`
1551 /// and returns it.
1552 /// Note that verification is still experimental and may not
1553 /// catch every error, or be maximally performant. For the
1554 /// previous, unchecked, behavior use
1555 /// `root_as_monster_unchecked`.
root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer>1556 pub fn root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
1557 flatbuffers::root::<Monster>(buf)
1558 }
1559 #[inline]
1560 /// Verifies that a buffer of bytes contains a size prefixed
1561 /// `Monster` and returns it.
1562 /// Note that verification is still experimental and may not
1563 /// catch every error, or be maximally performant. For the
1564 /// previous, unchecked, behavior use
1565 /// `size_prefixed_root_as_monster_unchecked`.
size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer>1566 pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
1567 flatbuffers::size_prefixed_root::<Monster>(buf)
1568 }
1569 #[inline]
1570 /// Verifies, with the given options, that a buffer of bytes
1571 /// contains a `Monster` and returns it.
1572 /// Note that verification is still experimental and may not
1573 /// catch every error, or be maximally performant. For the
1574 /// previous, unchecked, behavior use
1575 /// `root_as_monster_unchecked`.
root_as_monster_with_opts<'b, 'o>( opts: &'o flatbuffers::VerifierOptions, buf: &'b [u8], ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer>1576 pub fn root_as_monster_with_opts<'b, 'o>(
1577 opts: &'o flatbuffers::VerifierOptions,
1578 buf: &'b [u8],
1579 ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer> {
1580 flatbuffers::root_with_opts::<Monster<'b>>(opts, buf)
1581 }
1582 #[inline]
1583 /// Verifies, with the given verifier options, that a buffer of
1584 /// bytes contains a size prefixed `Monster` and returns
1585 /// it. Note that verification is still experimental and may not
1586 /// catch every error, or be maximally performant. For the
1587 /// previous, unchecked, behavior use
1588 /// `root_as_monster_unchecked`.
size_prefixed_root_as_monster_with_opts<'b, 'o>( opts: &'o flatbuffers::VerifierOptions, buf: &'b [u8], ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer>1589 pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
1590 opts: &'o flatbuffers::VerifierOptions,
1591 buf: &'b [u8],
1592 ) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer> {
1593 flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf)
1594 }
1595 #[inline]
1596 /// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
1597 /// # Safety
1598 /// Callers must trust the given bytes do indeed contain a valid `Monster`.
root_as_monster_unchecked(buf: &[u8]) -> Monster1599 pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster {
1600 flatbuffers::root_unchecked::<Monster>(buf)
1601 }
1602 #[inline]
1603 /// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
1604 /// # Safety
1605 /// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster1606 pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster {
1607 flatbuffers::size_prefixed_root_unchecked::<Monster>(buf)
1608 }
1609 pub const MONSTER_IDENTIFIER: &str = "MONS";
1610
1611 #[inline]
monster_buffer_has_identifier(buf: &[u8]) -> bool1612 pub fn monster_buffer_has_identifier(buf: &[u8]) -> bool {
1613 flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, false)
1614 }
1615
1616 #[inline]
monster_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool1617 pub fn monster_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
1618 flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, true)
1619 }
1620
1621 pub const MONSTER_EXTENSION: &str = "mon";
1622
1623 #[inline]
finish_monster_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>)1624 pub fn finish_monster_buffer<'a, 'b>(
1625 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1626 root: flatbuffers::WIPOffset<Monster<'a>>) {
1627 fbb.finish(root, Some(MONSTER_IDENTIFIER));
1628 }
1629
1630 #[inline]
finish_size_prefixed_monster_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>)1631 pub fn finish_size_prefixed_monster_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Monster<'a>>) {
1632 fbb.finish_size_prefixed(root, Some(MONSTER_IDENTIFIER));
1633 }
1634