...
1// automatically generated by the FlatBuffers compiler, do not modify
2// @generated
3extern crate alloc;
4extern crate flatbuffers;
5use alloc::boxed::Box;
6use alloc::string::{String, ToString};
7use alloc::vec::Vec;
8use core::mem;
9use core::cmp::Ordering;
10use self::flatbuffers::{EndianScalar, Follow};
11use super::*;
12pub(crate) enum GameOffset {}
13#[derive(Copy, Clone, PartialEq)]
14
15pub(crate) struct Game<'a> {
16 pub _tab: flatbuffers::Table<'a>,
17}
18
19impl<'a> flatbuffers::Follow<'a> for Game<'a> {
20 type Inner = Game<'a>;
21 #[inline]
22 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 Self { _tab: flatbuffers::Table::new(buf, loc) }
24 }
25}
26
27impl<'a> Game<'a> {
28 pub const VT_VALUE: flatbuffers::VOffsetT = 4;
29
30 pub const fn get_fully_qualified_name() -> &'static str {
31 "Game"
32 }
33
34 #[inline]
35 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
36 Game { _tab: table }
37 }
38 #[allow(unused_mut)]
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
48 pub fn unpack(&self) -> GameT {
49 let value = self.value();
50 GameT {
51 value,
52 }
53 }
54
55 #[inline]
56 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
64impl flatbuffers::Verifiable for Game<'_> {
65 #[inline]
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}
76pub(crate) struct GameArgs {
77 pub value: i32,
78}
79impl<'a> Default for GameArgs {
80 #[inline]
81 fn default() -> Self {
82 GameArgs {
83 value: 0,
84 }
85 }
86}
87
88pub(crate) struct GameBuilder<'a: 'b, 'b> {
89 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
90 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
91}
92impl<'a: 'b, 'b> GameBuilder<'a, 'b> {
93 #[inline]
94 pub fn add_value(&mut self, value: i32) {
95 self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
96 }
97 #[inline]
98 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GameBuilder<'a, 'b> {
99 let start = _fbb.start_table();
100 GameBuilder {
101 fbb_: _fbb,
102 start_: start,
103 }
104 }
105 #[inline]
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
112impl core::fmt::Debug for Game<'_> {
113 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)]
121pub(crate) struct GameT {
122 pub value: i32,
123}
124impl Default for GameT {
125 fn default() -> Self {
126 Self {
127 value: 0,
128 }
129 }
130}
131impl GameT {
132 pub fn pack<'b>(
133 &self,
134 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
135 ) -> flatbuffers::WIPOffset<Game<'b>> {
136 let value = self.value;
137 Game::create(_fbb, &GameArgs{
138 value,
139 })
140 }
141}
View as plain text