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