• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // automatically generated by the FlatBuffers compiler, do not modify
2 
3 
4 
5 use crate::include_test1_generated::*;
6 use std::mem;
7 use std::cmp::Ordering;
8 
9 extern crate flatbuffers;
10 use self::flatbuffers::{EndianScalar, Follow};
11 
12 #[allow(unused_imports, dead_code)]
13 pub mod my_game {
14 
15   use crate::include_test1_generated::*;
16   use std::mem;
17   use std::cmp::Ordering;
18 
19   extern crate flatbuffers;
20   use self::flatbuffers::{EndianScalar, Follow};
21 #[allow(unused_imports, dead_code)]
22 pub mod other_name_space {
23 
24   use crate::include_test1_generated::*;
25   use std::mem;
26   use std::cmp::Ordering;
27 
28   extern crate flatbuffers;
29   use self::flatbuffers::{EndianScalar, Follow};
30 
31 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
32 pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
33 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
34 pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
35 #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
36 #[allow(non_camel_case_types)]
37 pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
38   FromInclude::IncludeVal,
39 ];
40 
41 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
42 #[repr(transparent)]
43 pub struct FromInclude(pub i64);
44 #[allow(non_upper_case_globals)]
45 impl FromInclude {
46   pub const IncludeVal: Self = Self(0);
47 
48   pub const ENUM_MIN: i64 = 0;
49   pub const ENUM_MAX: i64 = 0;
50   pub const ENUM_VALUES: &'static [Self] = &[
51     Self::IncludeVal,
52   ];
53   /// Returns the variant's name or "" if unknown.
variant_name(self) -> Option<&'static str>54   pub fn variant_name(self) -> Option<&'static str> {
55     match self {
56       Self::IncludeVal => Some("IncludeVal"),
57       _ => None,
58     }
59   }
60 }
61 impl std::fmt::Debug for FromInclude {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result62   fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
63     if let Some(name) = self.variant_name() {
64       f.write_str(name)
65     } else {
66       f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
67     }
68   }
69 }
70 impl<'a> flatbuffers::Follow<'a> for FromInclude {
71   type Inner = Self;
72   #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner73   fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
74     let b = unsafe {
75       flatbuffers::read_scalar_at::<i64>(buf, loc)
76     };
77     Self(b)
78   }
79 }
80 
81 impl flatbuffers::Push for FromInclude {
82     type Output = FromInclude;
83     #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])84     fn push(&self, dst: &mut [u8], _rest: &[u8]) {
85         unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); }
86     }
87 }
88 
89 impl flatbuffers::EndianScalar for FromInclude {
90   #[inline]
to_little_endian(self) -> Self91   fn to_little_endian(self) -> Self {
92     let b = i64::to_le(self.0);
93     Self(b)
94   }
95   #[inline]
96   #[allow(clippy::wrong_self_convention)]
from_little_endian(self) -> Self97   fn from_little_endian(self) -> Self {
98     let b = i64::from_le(self.0);
99     Self(b)
100   }
101 }
102 
103 impl<'a> flatbuffers::Verifiable for FromInclude {
104   #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>105   fn run_verifier(
106     v: &mut flatbuffers::Verifier, pos: usize
107   ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
108     use self::flatbuffers::Verifiable;
109     i64::run_verifier(v, pos)
110   }
111 }
112 
113 impl flatbuffers::SimpleToVerifyInSlice for FromInclude {}
114 // struct Unused, aligned to 4
115 #[repr(transparent)]
116 #[derive(Clone, Copy, PartialEq)]
117 pub struct Unused(pub [u8; 4]);
118 impl Default for Unused {
default() -> Self119   fn default() -> Self {
120     Self([0; 4])
121   }
122 }
123 impl std::fmt::Debug for Unused {
fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result124   fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
125     f.debug_struct("Unused")
126       .field("a", &self.a())
127       .finish()
128   }
129 }
130 
131 impl flatbuffers::SimpleToVerifyInSlice for Unused {}
132 impl flatbuffers::SafeSliceAccess for Unused {}
133 impl<'a> flatbuffers::Follow<'a> for Unused {
134   type Inner = &'a Unused;
135   #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner136   fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
137     <&'a Unused>::follow(buf, loc)
138   }
139 }
140 impl<'a> flatbuffers::Follow<'a> for &'a Unused {
141   type Inner = &'a Unused;
142   #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner143   fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
144     flatbuffers::follow_cast_ref::<Unused>(buf, loc)
145   }
146 }
147 impl<'b> flatbuffers::Push for Unused {
148     type Output = Unused;
149     #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])150     fn push(&self, dst: &mut [u8], _rest: &[u8]) {
151         let src = unsafe {
152             ::std::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
153         };
154         dst.copy_from_slice(src);
155     }
156 }
157 impl<'b> flatbuffers::Push for &'b Unused {
158     type Output = Unused;
159 
160     #[inline]
push(&self, dst: &mut [u8], _rest: &[u8])161     fn push(&self, dst: &mut [u8], _rest: &[u8]) {
162         let src = unsafe {
163             ::std::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
164         };
165         dst.copy_from_slice(src);
166     }
167 }
168 
169 impl<'a> flatbuffers::Verifiable for Unused {
170   #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>171   fn run_verifier(
172     v: &mut flatbuffers::Verifier, pos: usize
173   ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
174     use self::flatbuffers::Verifiable;
175     v.in_buffer::<Self>(pos)
176   }
177 }
178 impl<'a> Unused {
179   #[allow(clippy::too_many_arguments)]
new( a: i32, ) -> Self180   pub fn new(
181     a: i32,
182   ) -> Self {
183     let mut s = Self([0; 4]);
184     s.set_a(a);
185     s
186   }
187 
a(&self) -> i32188   pub fn a(&self) -> i32 {
189     let mut mem = core::mem::MaybeUninit::<i32>::uninit();
190     unsafe {
191       core::ptr::copy_nonoverlapping(
192         self.0[0..].as_ptr(),
193         mem.as_mut_ptr() as *mut u8,
194         core::mem::size_of::<i32>(),
195       );
196       mem.assume_init()
197     }.from_little_endian()
198   }
199 
set_a(&mut self, x: i32)200   pub fn set_a(&mut self, x: i32) {
201     let x_le = x.to_little_endian();
202     unsafe {
203       core::ptr::copy_nonoverlapping(
204         &x_le as *const i32 as *const u8,
205         self.0[0..].as_mut_ptr(),
206         core::mem::size_of::<i32>(),
207       );
208     }
209   }
210 
211 }
212 
213 pub enum TableBOffset {}
214 #[derive(Copy, Clone, PartialEq)]
215 
216 pub struct TableB<'a> {
217   pub _tab: flatbuffers::Table<'a>,
218 }
219 
220 impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
221     type Inner = TableB<'a>;
222     #[inline]
follow(buf: &'a [u8], loc: usize) -> Self::Inner223     fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
224         Self { _tab: flatbuffers::Table { buf, loc } }
225     }
226 }
227 
228 impl<'a> TableB<'a> {
229     #[inline]
init_from_table(table: flatbuffers::Table<'a>) -> Self230     pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
231         TableB { _tab: table }
232     }
233     #[allow(unused_mut)]
create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, args: &'args TableBArgs<'args>) -> flatbuffers::WIPOffset<TableB<'bldr>>234     pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
235         _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
236         args: &'args TableBArgs<'args>) -> flatbuffers::WIPOffset<TableB<'bldr>> {
237       let mut builder = TableBBuilder::new(_fbb);
238       if let Some(x) = args.a { builder.add_a(x); }
239       builder.finish()
240     }
241 
242     pub const VT_A: flatbuffers::VOffsetT = 4;
243 
244   #[inline]
a(&self) -> Option<super::super::TableA<'a>>245   pub fn a(&self) -> Option<super::super::TableA<'a>> {
246     self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)
247   }
248 }
249 
250 impl flatbuffers::Verifiable for TableB<'_> {
251   #[inline]
run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer>252   fn run_verifier(
253     v: &mut flatbuffers::Verifier, pos: usize
254   ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
255     use self::flatbuffers::Verifiable;
256     v.visit_table(pos)?
257      .visit_field::<flatbuffers::ForwardsUOffset<super::super::TableA>>(&"a", Self::VT_A, false)?
258      .finish();
259     Ok(())
260   }
261 }
262 pub struct TableBArgs<'a> {
263     pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>,
264 }
265 impl<'a> Default for TableBArgs<'a> {
266     #[inline]
default() -> Self267     fn default() -> Self {
268         TableBArgs {
269             a: None,
270         }
271     }
272 }
273 pub struct TableBBuilder<'a: 'b, 'b> {
274   fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
275   start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
276 }
277 impl<'a: 'b, 'b> TableBBuilder<'a, 'b> {
278   #[inline]
add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>)279   pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) {
280     self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
281   }
282   #[inline]
new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableBBuilder<'a, 'b>283   pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableBBuilder<'a, 'b> {
284     let start = _fbb.start_table();
285     TableBBuilder {
286       fbb_: _fbb,
287       start_: start,
288     }
289   }
290   #[inline]
finish(self) -> flatbuffers::WIPOffset<TableB<'a>>291   pub fn finish(self) -> flatbuffers::WIPOffset<TableB<'a>> {
292     let o = self.fbb_.end_table(self.start_);
293     flatbuffers::WIPOffset::new(o.value())
294   }
295 }
296 
297 impl std::fmt::Debug for TableB<'_> {
fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result298   fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
299     let mut ds = f.debug_struct("TableB");
300       ds.field("a", &self.a());
301       ds.finish()
302   }
303 }
304 }  // pub mod OtherNameSpace
305 }  // pub mod MyGame
306 
307