• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23     Self { _tab: flatbuffers::Table::new(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 unsafe 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, A: flatbuffers::Allocator + 'bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, args: &'args GameArgs ) -> flatbuffers::WIPOffset<Game<'bldr>>39   pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
40     _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
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     // Safety:
58     // Created from valid Table for this object
59     // which contains a valid value in this slot
60     unsafe { self._tab.get::<i32>(Game::VT_VALUE, Some(0)).unwrap()}
61   }
62 }
63 
64 impl flatbuffers::Verifiable for Game<'_> {
65   #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>66   fn run_verifier(
67     v: &mut flatbuffers::Verifier, pos: usize
68   ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
69     use self::flatbuffers::Verifiable;
70     v.visit_table(pos)?
71      .visit_field::<i32>("value", Self::VT_VALUE, false)?
72      .finish();
73     Ok(())
74   }
75 }
76 pub(crate) struct GameArgs {
77     pub value: i32,
78 }
79 impl<'a> Default for GameArgs {
80   #[inline]
default() -> Self81   fn default() -> Self {
82     GameArgs {
83       value: 0,
84     }
85   }
86 }
87 
88 pub(crate) struct GameBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
89   fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
90   start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
91 }
92 impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
93   #[inline]
add_value(&mut self, value: i32)94   pub fn add_value(&mut self, value: i32) {
95     self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
96   }
97   #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A>98   pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
99     let start = _fbb.start_table();
100     GameBuilder {
101       fbb_: _fbb,
102       start_: start,
103     }
104   }
105   #[inline]
finish(self) -> flatbuffers::WIPOffset<Game<'a>>106   pub fn finish(self) -> flatbuffers::WIPOffset<Game<'a>> {
107     let o = self.fbb_.end_table(self.start_);
108     flatbuffers::WIPOffset::new(o.value())
109   }
110 }
111 
112 impl core::fmt::Debug for Game<'_> {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result113   fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
114     let mut ds = f.debug_struct("Game");
115       ds.field("value", &self.value());
116       ds.finish()
117   }
118 }
119 #[non_exhaustive]
120 #[derive(Debug, Clone, PartialEq)]
121 pub(crate) struct GameT {
122   pub value: i32,
123 }
124 impl Default for GameT {
default() -> Self125   fn default() -> Self {
126     Self {
127       value: 0,
128     }
129   }
130 }
131 impl GameT {
pack<'b, A: flatbuffers::Allocator + 'b>( &self, _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> ) -> flatbuffers::WIPOffset<Game<'b>>132   pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
133     &self,
134     _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
135   ) -> flatbuffers::WIPOffset<Game<'b>> {
136     let value = self.value;
137     Game::create(_fbb, &GameArgs{
138       value,
139     })
140   }
141 }
142