blob: ab302991535e2e6b4b2868a27ed8ff3f318a7e8c [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2
3
4
5use std::mem;
6use std::cmp::Ordering;
7
8extern crate flatbuffers;
9use self::flatbuffers::EndianScalar;
10
11#[allow(unused_imports, dead_code)]
12pub mod namespace_a {
13
14 use std::mem;
15 use std::cmp::Ordering;
16
17 extern crate flatbuffers;
18 use self::flatbuffers::EndianScalar;
19#[allow(unused_imports, dead_code)]
20pub mod namespace_b {
21
22 use std::mem;
23 use std::cmp::Ordering;
24
25 extern crate flatbuffers;
26 use self::flatbuffers::EndianScalar;
27
28#[allow(non_camel_case_types)]
29#[repr(i8)]
30#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
31pub enum EnumInNestedNS {
32 A = 0,
33 B = 1,
34 C = 2,
35
36}
37
38const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
39const ENUM_MAX_ENUM_IN_NESTED_NS: i8 = 2;
40
41impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS {
42 type Inner = Self;
43 #[inline]
44 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
45 flatbuffers::read_scalar_at::<Self>(buf, loc)
46 }
47}
48
49impl flatbuffers::EndianScalar for EnumInNestedNS {
50 #[inline]
51 fn to_little_endian(self) -> Self {
52 let n = i8::to_le(self as i8);
53 let p = &n as *const i8 as *const EnumInNestedNS;
54 unsafe { *p }
55 }
56 #[inline]
57 fn from_little_endian(self) -> Self {
58 let n = i8::from_le(self as i8);
59 let p = &n as *const i8 as *const EnumInNestedNS;
60 unsafe { *p }
61 }
62}
63
64impl flatbuffers::Push for EnumInNestedNS {
65 type Output = EnumInNestedNS;
66 #[inline]
67 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
68 flatbuffers::emplace_scalar::<EnumInNestedNS>(dst, *self);
69 }
70}
71
72#[allow(non_camel_case_types)]
73const ENUM_VALUES_ENUM_IN_NESTED_NS:[EnumInNestedNS; 3] = [
74 EnumInNestedNS::A,
75 EnumInNestedNS::B,
76 EnumInNestedNS::C
77];
78
79#[allow(non_camel_case_types)]
80const ENUM_NAMES_ENUM_IN_NESTED_NS:[&'static str; 3] = [
81 "A",
82 "B",
83 "C"
84];
85
86pub fn enum_name_enum_in_nested_ns(e: EnumInNestedNS) -> &'static str {
87 let index = e as i8;
88 ENUM_NAMES_ENUM_IN_NESTED_NS[index as usize]
89}
90
91// struct StructInNestedNS, aligned to 4
92#[repr(C, align(4))]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub struct StructInNestedNS {
95 a_: i32,
96 b_: i32,
97} // pub struct StructInNestedNS
98impl flatbuffers::SafeSliceAccess for StructInNestedNS {}
99impl<'a> flatbuffers::Follow<'a> for StructInNestedNS {
100 type Inner = &'a StructInNestedNS;
101 #[inline]
102 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
103 <&'a StructInNestedNS>::follow(buf, loc)
104 }
105}
106impl<'a> flatbuffers::Follow<'a> for &'a StructInNestedNS {
107 type Inner = &'a StructInNestedNS;
108 #[inline]
109 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
110 flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc)
111 }
112}
113impl<'b> flatbuffers::Push for StructInNestedNS {
114 type Output = StructInNestedNS;
115 #[inline]
116 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
117 let src = unsafe {
118 ::std::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size())
119 };
120 dst.copy_from_slice(src);
121 }
122}
123impl<'b> flatbuffers::Push for &'b StructInNestedNS {
124 type Output = StructInNestedNS;
125
126 #[inline]
127 fn push(&self, dst: &mut [u8], _rest: &[u8]) {
128 let src = unsafe {
129 ::std::slice::from_raw_parts(*self as *const StructInNestedNS as *const u8, Self::size())
130 };
131 dst.copy_from_slice(src);
132 }
133}
134
135
136impl StructInNestedNS {
137 pub fn new<'a>(_a: i32, _b: i32) -> Self {
138 StructInNestedNS {
139 a_: _a.to_little_endian(),
140 b_: _b.to_little_endian(),
141
142 }
143 }
144 pub fn a<'a>(&'a self) -> i32 {
145 self.a_.from_little_endian()
146 }
147 pub fn b<'a>(&'a self) -> i32 {
148 self.b_.from_little_endian()
149 }
150}
151
152pub enum TableInNestedNSOffset {}
153#[derive(Copy, Clone, Debug, PartialEq)]
154
155pub struct TableInNestedNS<'a> {
156 pub _tab: flatbuffers::Table<'a>,
157}
158
159impl<'a> flatbuffers::Follow<'a> for TableInNestedNS<'a> {
160 type Inner = TableInNestedNS<'a>;
161 #[inline]
162 fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
163 Self {
164 _tab: flatbuffers::Table { buf: buf, loc: loc },
165 }
166 }
167}
168
169impl<'a> TableInNestedNS<'a> {
170 #[inline]
171 pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
172 TableInNestedNS {
173 _tab: table,
174 }
175 }
176 #[allow(unused_mut)]
177 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
178 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
179 args: &'args TableInNestedNSArgs) -> flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
180 let mut builder = TableInNestedNSBuilder::new(_fbb);
181 builder.add_foo(args.foo);
182 builder.finish()
183 }
184
185 pub const VT_FOO: flatbuffers::VOffsetT = 4;
186
187 #[inline]
188 pub fn foo(&self) -> i32 {
189 self._tab.get::<i32>(TableInNestedNS::VT_FOO, Some(0)).unwrap()
190 }
191}
192
193pub struct TableInNestedNSArgs {
194 pub foo: i32,
195}
196impl<'a> Default for TableInNestedNSArgs {
197 #[inline]
198 fn default() -> Self {
199 TableInNestedNSArgs {
200 foo: 0,
201 }
202 }
203}
204pub struct TableInNestedNSBuilder<'a: 'b, 'b> {
205 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
206 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
207}
208impl<'a: 'b, 'b> TableInNestedNSBuilder<'a, 'b> {
209 #[inline]
210 pub fn add_foo(&mut self, foo: i32) {
211 self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
212 }
213 #[inline]
214 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableInNestedNSBuilder<'a, 'b> {
215 let start = _fbb.start_table();
216 TableInNestedNSBuilder {
217 fbb_: _fbb,
218 start_: start,
219 }
220 }
221 #[inline]
222 pub fn finish(self) -> flatbuffers::WIPOffset<TableInNestedNS<'a>> {
223 let o = self.fbb_.end_table(self.start_);
224 flatbuffers::WIPOffset::new(o.value())
225 }
226}
227
228} // pub mod NamespaceB
229} // pub mod NamespaceA
230