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