Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 4 | #![allow(unused_imports, dead_code)] |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 5 | |
| 6 | use std::mem; |
| 7 | use std::cmp::Ordering; |
| 8 | |
| 9 | extern crate flatbuffers; |
| 10 | use self::flatbuffers::EndianScalar; |
| 11 | |
| 12 | #[allow(unused_imports, dead_code)] |
| 13 | pub 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)] |
| 21 | pub 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 Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 29 | #[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 30 | pub 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.")] |
| 32 | pub 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 Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 34 | #[allow(non_camel_case_types)] |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 35 | pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [ |
| 36 | EnumInNestedNS::A, |
| 37 | EnumInNestedNS::B, |
| 38 | EnumInNestedNS::C, |
| 39 | ]; |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 40 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 41 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 42 | #[repr(transparent)] |
| 43 | pub struct EnumInNestedNS(pub i8); |
| 44 | #[allow(non_upper_case_globals)] |
| 45 | impl 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 Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 66 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 67 | impl 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 Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 76 | impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS { |
| 77 | type Inner = Self; |
| 78 | #[inline] |
| 79 | fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 80 | Self(flatbuffers::read_scalar_at::<i8>(buf, loc)) |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | |
| 84 | impl flatbuffers::Push for EnumInNestedNS { |
| 85 | type Output = EnumInNestedNS; |
| 86 | #[inline] |
| 87 | fn push(&self, dst: &mut [u8], _rest: &[u8]) { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 88 | flatbuffers::emplace_scalar::<i8>(dst, self.0); |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 89 | } |
| 90 | } |
| 91 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 92 | impl 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 Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | // struct StructInNestedNS, aligned to 4 |
| 104 | #[repr(C, align(4))] |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 105 | #[derive(Clone, Copy, PartialEq)] |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 106 | pub struct StructInNestedNS { |
| 107 | a_: i32, |
| 108 | b_: i32, |
| 109 | } // pub struct StructInNestedNS |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 110 | impl 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 Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 119 | impl flatbuffers::SafeSliceAccess for StructInNestedNS {} |
| 120 | impl<'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 | } |
| 127 | impl<'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 | } |
| 134 | impl<'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 | } |
| 144 | impl<'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 | |
| 157 | impl StructInNestedNS { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 158 | pub fn new(_a: i32, _b: i32) -> Self { |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 159 | StructInNestedNS { |
| 160 | a_: _a.to_little_endian(), |
| 161 | b_: _b.to_little_endian(), |
| 162 | |
| 163 | } |
| 164 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 165 | pub const fn get_fully_qualified_name() -> &'static str { |
| 166 | "NamespaceA.NamespaceB.StructInNestedNS" |
| 167 | } |
| 168 | |
| 169 | pub fn a(&self) -> i32 { |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 170 | self.a_.from_little_endian() |
| 171 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 172 | pub fn b(&self) -> i32 { |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 173 | self.b_.from_little_endian() |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | pub enum TableInNestedNSOffset {} |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 178 | #[derive(Copy, Clone, PartialEq)] |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 179 | |
| 180 | pub struct TableInNestedNS<'a> { |
| 181 | pub _tab: flatbuffers::Table<'a>, |
| 182 | } |
| 183 | |
| 184 | impl<'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 Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 188 | Self { _tab: flatbuffers::Table { buf, loc } } |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
| 192 | impl<'a> TableInNestedNS<'a> { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 193 | pub const fn get_fully_qualified_name() -> &'static str { |
| 194 | "NamespaceA.NamespaceB.TableInNestedNS" |
| 195 | } |
| 196 | |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 197 | #[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 | |
| 220 | pub struct TableInNestedNSArgs { |
| 221 | pub foo: i32, |
| 222 | } |
| 223 | impl<'a> Default for TableInNestedNSArgs { |
| 224 | #[inline] |
| 225 | fn default() -> Self { |
| 226 | TableInNestedNSArgs { |
| 227 | foo: 0, |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | pub struct TableInNestedNSBuilder<'a: 'b, 'b> { |
| 232 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 233 | start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, |
| 234 | } |
| 235 | impl<'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 Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 255 | impl 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 Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 262 | } // pub mod NamespaceB |
| 263 | } // pub mod NamespaceA |
| 264 | |