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 enum ArrayTableOffset {}
13#[derive(Copy, Clone, PartialEq)]
14
15pub struct ArrayTable<'a> {
16 pub _tab: flatbuffers::Table<'a>,
17}
18
19impl<'a> flatbuffers::Follow<'a> for ArrayTable<'a> {
20 type Inner = ArrayTable<'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> ArrayTable<'a> {
28 pub const VT_A: flatbuffers::VOffsetT = 4;
29
30 pub const fn get_fully_qualified_name() -> &'static str {
31 "MyGame.Example.ArrayTable"
32 }
33
34 #[inline]
35 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
36 ArrayTable { _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 ArrayTableArgs<'args>
42 ) -> flatbuffers::WIPOffset<ArrayTable<'bldr>> {
43 let mut builder = ArrayTableBuilder::new(_fbb);
44 if let Some(x) = args.a { builder.add_a(x); }
45 builder.finish()
46 }
47
48 pub fn unpack(&self) -> ArrayTableT {
49 let a = self.a().map(|x| {
50 x.unpack()
51 });
52 ArrayTableT {
53 a,
54 }
55 }
56
57 #[inline]
58 pub fn a(&self) -> Option<&'a ArrayStruct> {
59 // Safety:
60 // Created from valid Table for this object
61 // which contains a valid value in this slot
62 unsafe { self._tab.get::<ArrayStruct>(ArrayTable::VT_A, None)}
63 }
64}
65
66impl flatbuffers::Verifiable for ArrayTable<'_> {
67 #[inline]
68 fn run_verifier(
69 v: &mut flatbuffers::Verifier, pos: usize
70 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
71 use self::flatbuffers::Verifiable;
72 v.visit_table(pos)?
73 .visit_field::<ArrayStruct>("a", Self::VT_A, false)?
74 .finish();
75 Ok(())
76 }
77}
78pub struct ArrayTableArgs<'a> {
79 pub a: Option<&'a ArrayStruct>,
80}
81impl<'a> Default for ArrayTableArgs<'a> {
82 #[inline]
83 fn default() -> Self {
84 ArrayTableArgs {
85 a: None,
86 }
87 }
88}
89
90pub struct ArrayTableBuilder<'a: 'b, 'b> {
91 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
92 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
93}
94impl<'a: 'b, 'b> ArrayTableBuilder<'a, 'b> {
95 #[inline]
96 pub fn add_a(&mut self, a: &ArrayStruct) {
97 self.fbb_.push_slot_always::<&ArrayStruct>(ArrayTable::VT_A, a);
98 }
99 #[inline]
100 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ArrayTableBuilder<'a, 'b> {
101 let start = _fbb.start_table();
102 ArrayTableBuilder {
103 fbb_: _fbb,
104 start_: start,
105 }
106 }
107 #[inline]
108 pub fn finish(self) -> flatbuffers::WIPOffset<ArrayTable<'a>> {
109 let o = self.fbb_.end_table(self.start_);
110 flatbuffers::WIPOffset::new(o.value())
111 }
112}
113
114impl core::fmt::Debug for ArrayTable<'_> {
115 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
116 let mut ds = f.debug_struct("ArrayTable");
117 ds.field("a", &self.a());
118 ds.finish()
119 }
120}
121#[non_exhaustive]
122#[derive(Debug, Clone, PartialEq)]
123pub struct ArrayTableT {
124 pub a: Option<ArrayStructT>,
125}
126impl Default for ArrayTableT {
127 fn default() -> Self {
128 Self {
129 a: None,
130 }
131 }
132}
133impl ArrayTableT {
134 pub fn pack<'b>(
135 &self,
136 _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
137 ) -> flatbuffers::WIPOffset<ArrayTable<'b>> {
138 let a_tmp = self.a.as_ref().map(|x| x.pack());
139 let a = a_tmp.as_ref();
140 ArrayTable::create(_fbb, &ArrayTableArgs{
141 a,
142 })
143 }
144}
145#[inline]
146/// Verifies that a buffer of bytes contains a `ArrayTable`
147/// and returns it.
148/// Note that verification is still experimental and may not
149/// catch every error, or be maximally performant. For the
150/// previous, unchecked, behavior use
151/// `root_as_array_table_unchecked`.
152pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable, flatbuffers::InvalidFlatbuffer> {
153 flatbuffers::root::<ArrayTable>(buf)
154}
155#[inline]
156/// Verifies that a buffer of bytes contains a size prefixed
157/// `ArrayTable` and returns it.
158/// Note that verification is still experimental and may not
159/// catch every error, or be maximally performant. For the
160/// previous, unchecked, behavior use
161/// `size_prefixed_root_as_array_table_unchecked`.
162pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable, flatbuffers::InvalidFlatbuffer> {
163 flatbuffers::size_prefixed_root::<ArrayTable>(buf)
164}
165#[inline]
166/// Verifies, with the given options, that a buffer of bytes
167/// contains a `ArrayTable` and returns it.
168/// Note that verification is still experimental and may not
169/// catch every error, or be maximally performant. For the
170/// previous, unchecked, behavior use
171/// `root_as_array_table_unchecked`.
172pub fn root_as_array_table_with_opts<'b, 'o>(
173 opts: &'o flatbuffers::VerifierOptions,
174 buf: &'b [u8],
175) -> Result<ArrayTable<'b>, flatbuffers::InvalidFlatbuffer> {
176 flatbuffers::root_with_opts::<ArrayTable<'b>>(opts, buf)
177}
178#[inline]
179/// Verifies, with the given verifier options, that a buffer of
180/// bytes contains a size prefixed `ArrayTable` and returns
181/// it. Note that verification is still experimental and may not
182/// catch every error, or be maximally performant. For the
183/// previous, unchecked, behavior use
184/// `root_as_array_table_unchecked`.
185pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>(
186 opts: &'o flatbuffers::VerifierOptions,
187 buf: &'b [u8],
188) -> Result<ArrayTable<'b>, flatbuffers::InvalidFlatbuffer> {
189 flatbuffers::size_prefixed_root_with_opts::<ArrayTable<'b>>(opts, buf)
190}
191#[inline]
192/// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it.
193/// # Safety
194/// Callers must trust the given bytes do indeed contain a valid `ArrayTable`.
195pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable {
196 flatbuffers::root_unchecked::<ArrayTable>(buf)
197}
198#[inline]
199/// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it.
200/// # Safety
201/// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`.
202pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable {
203 flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf)
204}
205pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT";
206
207#[inline]
208pub fn array_table_buffer_has_identifier(buf: &[u8]) -> bool {
209 flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, false)
210}
211
212#[inline]
213pub fn array_table_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
214 flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, true)
215}
216
217pub const ARRAY_TABLE_EXTENSION: &str = "mon";
218
219#[inline]
220pub fn finish_array_table_buffer<'a, 'b>(
221 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
222 root: flatbuffers::WIPOffset<ArrayTable<'a>>) {
223 fbb.finish(root, Some(ARRAY_TABLE_IDENTIFIER));
224}
225
226#[inline]
227pub fn finish_size_prefixed_array_table_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<ArrayTable<'a>>) {
228 fbb.finish_size_prefixed(root, Some(ARRAY_TABLE_IDENTIFIER));
229}
View as plain text