Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | |
| 4 | #![allow(unused_imports, dead_code)] |
| 5 | |
| 6 | use crate::include_test2_generated::*; |
| 7 | use std::mem; |
| 8 | use std::cmp::Ordering; |
| 9 | |
| 10 | extern crate flatbuffers; |
| 11 | use self::flatbuffers::EndianScalar; |
| 12 | |
| 13 | pub enum TableAOffset {} |
| 14 | #[derive(Copy, Clone, PartialEq)] |
| 15 | |
| 16 | pub struct TableA<'a> { |
| 17 | pub _tab: flatbuffers::Table<'a>, |
| 18 | } |
| 19 | |
| 20 | impl<'a> flatbuffers::Follow<'a> for TableA<'a> { |
| 21 | type Inner = TableA<'a>; |
| 22 | #[inline] |
| 23 | fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
| 24 | Self { _tab: flatbuffers::Table { buf, loc } } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | impl<'a> TableA<'a> { |
| 29 | #[inline] |
| 30 | pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { |
| 31 | TableA { |
| 32 | _tab: table, |
| 33 | } |
| 34 | } |
| 35 | #[allow(unused_mut)] |
| 36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( |
| 37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, |
| 38 | args: &'args TableAArgs<'args>) -> flatbuffers::WIPOffset<TableA<'bldr>> { |
| 39 | let mut builder = TableABuilder::new(_fbb); |
| 40 | if let Some(x) = args.b { builder.add_b(x); } |
| 41 | builder.finish() |
| 42 | } |
| 43 | |
| 44 | pub const VT_B: flatbuffers::VOffsetT = 4; |
| 45 | |
| 46 | #[inline] |
| 47 | pub fn b(&self) -> Option<my_game::other_name_space::TableB<'a>> { |
| 48 | self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB<'a>>>(TableA::VT_B, None) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | pub struct TableAArgs<'a> { |
| 53 | pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, |
| 54 | } |
| 55 | impl<'a> Default for TableAArgs<'a> { |
| 56 | #[inline] |
| 57 | fn default() -> Self { |
| 58 | TableAArgs { |
| 59 | b: None, |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | pub struct TableABuilder<'a: 'b, 'b> { |
| 64 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 65 | start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, |
| 66 | } |
| 67 | impl<'a: 'b, 'b> TableABuilder<'a, 'b> { |
| 68 | #[inline] |
| 69 | pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { |
| 70 | self.fbb_.push_slot_always::<flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); |
| 71 | } |
| 72 | #[inline] |
| 73 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableABuilder<'a, 'b> { |
| 74 | let start = _fbb.start_table(); |
| 75 | TableABuilder { |
| 76 | fbb_: _fbb, |
| 77 | start_: start, |
| 78 | } |
| 79 | } |
| 80 | #[inline] |
| 81 | pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> { |
| 82 | let o = self.fbb_.end_table(self.start_); |
| 83 | flatbuffers::WIPOffset::new(o.value()) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | impl std::fmt::Debug for TableA<'_> { |
| 88 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 89 | let mut ds = f.debug_struct("TableA"); |
| 90 | ds.field("b", &self.b()); |
| 91 | ds.finish() |
| 92 | } |
| 93 | } |