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(crate) enum GameOffset {} 13 #[derive(Copy, Clone, PartialEq)] 14 15 pub(crate) struct Game<'a> { 16 pub _tab: flatbuffers::Table<'a>, 17 } 18 19 impl<'a> flatbuffers::Follow<'a> for Game<'a> { 20 type Inner = Game<'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> Game<'a> { 28 pub const VT_VALUE: flatbuffers::VOffsetT = 4; 29 get_fully_qualified_name() -> &'static str30 pub const fn get_fully_qualified_name() -> &'static str { 31 "Game" 32 } 33 34 #[inline] init_from_table(table: flatbuffers::Table<'a>) -> Self35 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { 36 Game { _tab: table } 37 } 38 #[allow(unused_mut)] create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args GameArgs ) -> flatbuffers::WIPOffset<Game<'bldr>>39 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( 40 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, 41 args: &'args GameArgs 42 ) -> flatbuffers::WIPOffset<Game<'bldr>> { 43 let mut builder = GameBuilder::new(_fbb); 44 builder.add_value(args.value); 45 builder.finish() 46 } 47 unpack(&self) -> GameT48 pub fn unpack(&self) -> GameT { 49 let value = self.value(); 50 GameT { 51 value, 52 } 53 } 54 55 #[inline] value(&self) -> i3256 pub fn value(&self) -> i32 { 57 self._tab.get::<i32>(Game::VT_VALUE, Some(0)).unwrap() 58 } 59 } 60 61 impl flatbuffers::Verifiable for Game<'_> { 62 #[inline] run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>63 fn run_verifier( 64 v: &mut flatbuffers::Verifier, pos: usize 65 ) -> Result<(), flatbuffers::InvalidFlatbuffer> { 66 use self::flatbuffers::Verifiable; 67 v.visit_table(pos)? 68 .visit_field::<i32>("value", Self::VT_VALUE, false)? 69 .finish(); 70 Ok(()) 71 } 72 } 73 pub(crate) struct GameArgs { 74 pub value: i32, 75 } 76 impl<'a> Default for GameArgs { 77 #[inline] default() -> Self78 fn default() -> Self { 79 GameArgs { 80 value: 0, 81 } 82 } 83 } 84 85 pub(crate) struct GameBuilder<'a: 'b, 'b> { 86 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, 87 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, 88 } 89 impl<'a: 'b, 'b> GameBuilder<'a, 'b> { 90 #[inline] add_value(&mut self, value: i32)91 pub fn add_value(&mut self, value: i32) { 92 self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0); 93 } 94 #[inline] new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GameBuilder<'a, 'b>95 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GameBuilder<'a, 'b> { 96 let start = _fbb.start_table(); 97 GameBuilder { 98 fbb_: _fbb, 99 start_: start, 100 } 101 } 102 #[inline] finish(self) -> flatbuffers::WIPOffset<Game<'a>>103 pub fn finish(self) -> flatbuffers::WIPOffset<Game<'a>> { 104 let o = self.fbb_.end_table(self.start_); 105 flatbuffers::WIPOffset::new(o.value()) 106 } 107 } 108 109 impl core::fmt::Debug for Game<'_> { fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result110 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 111 let mut ds = f.debug_struct("Game"); 112 ds.field("value", &self.value()); 113 ds.finish() 114 } 115 } 116 #[non_exhaustive] 117 #[derive(Debug, Clone, PartialEq)] 118 pub(crate) struct GameT { 119 pub value: i32, 120 } 121 impl Default for GameT { default() -> Self122 fn default() -> Self { 123 Self { 124 value: 0, 125 } 126 } 127 } 128 impl GameT { pack<'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b> ) -> flatbuffers::WIPOffset<Game<'b>>129 pub fn pack<'b>( 130 &self, 131 _fbb: &mut flatbuffers::FlatBufferBuilder<'b> 132 ) -> flatbuffers::WIPOffset<Game<'b>> { 133 let value = self.value; 134 Game::create(_fbb, &GameArgs{ 135 value, 136 }) 137 } 138 } 139