blob: dd735a60e393b63680d32bb0c46166b87d4bc660 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2
3
Austin Schuh272c6132020-11-14 16:37:52 -08004#![allow(unused_imports, dead_code)]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07005
6use std::mem;
7use std::cmp::Ordering;
8
9extern crate flatbuffers;
10use self::flatbuffers::EndianScalar;
11
12#[allow(unused_imports, dead_code)]
13pub mod namespace_a {
14
15 use std::mem;
16 use std::cmp::Ordering;
17
18 extern crate flatbuffers;
19 use self::flatbuffers::EndianScalar;
20#[allow(unused_imports, dead_code)]
21pub mod namespace_b {
22
23 use std::mem;
24 use std::cmp::Ordering;
25
26 extern crate flatbuffers;
27 use self::flatbuffers::EndianScalar;
28
Austin Schuh272c6132020-11-14 16:37:52 -080029#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
30pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
31#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
32pub const ENUM_MAX_ENUM_IN_NESTED_NS: i8 = 2;
33#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
Austin Schuhe89fa2d2019-08-14 20:24:23 -070034#[allow(non_camel_case_types)]
Austin Schuh272c6132020-11-14 16:37:52 -080035pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [
36 EnumInNestedNS::A,
37 EnumInNestedNS::B,
38 EnumInNestedNS::C,
39];
Austin Schuhe89fa2d2019-08-14 20:24:23 -070040
Austin Schuh272c6132020-11-14 16:37:52 -080041#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
42#[repr(transparent)]
43pub struct EnumInNestedNS(pub i8);
44#[allow(non_upper_case_globals)]
45impl EnumInNestedNS {
46 pub const A: Self = Self(0);
47 pub const B: Self = Self(1);
48 pub const C: Self = Self(2);
49
50 pub const ENUM_MIN: i8 = 0;
51 pub const ENUM_MAX: i8 = 2;
52 pub const ENUM_VALUES: &'static [Self] = &[
53 Self::A,
54 Self::B,
55 Self::C,
56 ];
57 /// Returns the variant's name or "" if unknown.
58 pub fn variant_name(self) -> Option<&'static str> {
59 match self {
60 Self::A => Some("A"),
61 Self::B => Some("B"),
62 Self::C => Some("C"),
63 _ => None,
64 }
65 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -070066}
Austin Schuh272c6132020-11-14 16:37:52 -080067impl std::fmt::Debug for EnumInNestedNS {
68 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
69 if let Some(name) = self.variant_name() {
70 f.write_str(name)
71 } else {
72 f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
73 }
74 }
75}
Austin Schuhe89fa2d2019-08-14 20:24:23 -070076impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS {
77 type Inner = Self;
78 #[inline]
79 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Austin Schuh272c6132020-11-14 16:37:52 -080080 Self(flatbuffers::read_scalar_at::<i8>(buf, loc))
Austin Schuhe89fa2d2019-08-14 20:24:23 -070081 }
82}
83
84impl flatbuffers::Push for EnumInNestedNS {
85 type Output = EnumInNestedNS;
86 #[inline]
87 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
Austin Schuh272c6132020-11-14 16:37:52 -080088 flatbuffers::emplace_scalar::<i8>(dst, self.0);
Austin Schuhe89fa2d2019-08-14 20:24:23 -070089 }
90}
91
Austin Schuh272c6132020-11-14 16:37:52 -080092impl flatbuffers::EndianScalar for EnumInNestedNS {
93 #[inline]
94 fn to_little_endian(self) -> Self {
95 Self(i8::to_le(self.0))
96 }
97 #[inline]
98 fn from_little_endian(self) -> Self {
99 Self(i8::from_le(self.0))
100 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700101}
102
103// struct StructInNestedNS, aligned to 4
104#[repr(C, align(4))]
Austin Schuh272c6132020-11-14 16:37:52 -0800105#[derive(Clone, Copy, PartialEq)]
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700106pub struct StructInNestedNS {
107 a_: i32,
108 b_: i32,
109} // pub struct StructInNestedNS
Austin Schuh272c6132020-11-14 16:37:52 -0800110impl std::fmt::Debug for StructInNestedNS {
111 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
112 f.debug_struct("StructInNestedNS")
113 .field("a", &self.a())
114 .field("b", &self.b())
115 .finish()
116 }
117}
118
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700119impl flatbuffers::SafeSliceAccess for StructInNestedNS {}
120impl<'a> flatbuffers::Follow<'a> for StructInNestedNS {
121 type Inner = &'a StructInNestedNS;
122 #[inline]
123 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
124 <&'a StructInNestedNS>::follow(buf, loc)
125 }
126}
127impl<'a> flatbuffers::Follow<'a> for &'a StructInNestedNS {
128 type Inner = &'a StructInNestedNS;
129 #[inline]
130 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
131 flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc)
132 }
133}
134impl<'b> flatbuffers::Push for StructInNestedNS {
135 type Output = StructInNestedNS;
136 #[inline]
137 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
138 let src = unsafe {
139 ::std::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size())
140 };
141 dst.copy_from_slice(src);
142 }
143}
144impl<'b> flatbuffers::Push for &'b StructInNestedNS {
145 type Output = StructInNestedNS;
146
147 #[inline]
148 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
149 let src = unsafe {
150 ::std::slice::from_raw_parts(*self as *const StructInNestedNS as *const u8, Self::size())
151 };
152 dst.copy_from_slice(src);
153 }
154}
155
156
157impl StructInNestedNS {
Austin Schuh272c6132020-11-14 16:37:52 -0800158 pub fn new(_a: i32, _b: i32) -> Self {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700159 StructInNestedNS {
160 a_: _a.to_little_endian(),
161 b_: _b.to_little_endian(),
162
163 }
164 }
Austin Schuh272c6132020-11-14 16:37:52 -0800165 pub const fn get_fully_qualified_name() -> &'static str {
166 "NamespaceA.NamespaceB.StructInNestedNS"
167 }
168
169 pub fn a(&self) -> i32 {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700170 self.a_.from_little_endian()
171 }
Austin Schuh272c6132020-11-14 16:37:52 -0800172 pub fn b(&self) -> i32 {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700173 self.b_.from_little_endian()
174 }
175}
176
177pub enum TableInNestedNSOffset {}
Austin Schuh272c6132020-11-14 16:37:52 -0800178#[derive(Copy, Clone, PartialEq)]
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700179
180pub struct TableInNestedNS<'a> {
181 pub _tab: flatbuffers::Table<'a>,
182}
183
184impl<'a> flatbuffers::Follow<'a> for TableInNestedNS<'a> {
185 type Inner = TableInNestedNS<'a>;
186 #[inline]
187 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Austin Schuh272c6132020-11-14 16:37:52 -0800188 Self { _tab: flatbuffers::Table { buf, loc } }
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700189 }
190}
191
192impl<'a> TableInNestedNS<'a> {
Austin Schuh272c6132020-11-14 16:37:52 -0800193 pub const fn get_fully_qualified_name() -> &'static str {
194 "NamespaceA.NamespaceB.TableInNestedNS"
195 }
196
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700197 #[inline]
198 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
199 TableInNestedNS {
200 _tab: table,
201 }
202 }
203 #[allow(unused_mut)]
204 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
205 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
206 args: &'args TableInNestedNSArgs) -> flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
207 let mut builder = TableInNestedNSBuilder::new(_fbb);
208 builder.add_foo(args.foo);
209 builder.finish()
210 }
211
212 pub const VT_FOO: flatbuffers::VOffsetT = 4;
213
214 #[inline]
215 pub fn foo(&self) -> i32 {
216 self._tab.get::<i32>(TableInNestedNS::VT_FOO, Some(0)).unwrap()
217 }
218}
219
220pub struct TableInNestedNSArgs {
221 pub foo: i32,
222}
223impl<'a> Default for TableInNestedNSArgs {
224 #[inline]
225 fn default() -> Self {
226 TableInNestedNSArgs {
227 foo: 0,
228 }
229 }
230}
231pub struct TableInNestedNSBuilder<'a: 'b, 'b> {
232 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
233 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
234}
235impl<'a: 'b, 'b> TableInNestedNSBuilder<'a, 'b> {
236 #[inline]
237 pub fn add_foo(&mut self, foo: i32) {
238 self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
239 }
240 #[inline]
241 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableInNestedNSBuilder<'a, 'b> {
242 let start = _fbb.start_table();
243 TableInNestedNSBuilder {
244 fbb_: _fbb,
245 start_: start,
246 }
247 }
248 #[inline]
249 pub fn finish(self) -> flatbuffers::WIPOffset<TableInNestedNS<'a>> {
250 let o = self.fbb_.end_table(self.start_);
251 flatbuffers::WIPOffset::new(o.value())
252 }
253}
254
Austin Schuh272c6132020-11-14 16:37:52 -0800255impl std::fmt::Debug for TableInNestedNS<'_> {
256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
257 let mut ds = f.debug_struct("TableInNestedNS");
258 ds.field("foo", &self.foo());
259 ds.finish()
260 }
261}
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700262} // pub mod NamespaceB
263} // pub mod NamespaceA
264