Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | |
| 4 | #![allow(unused_imports, dead_code)] |
| 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 optional_scalars { |
| 14 | |
| 15 | use std::mem; |
| 16 | use std::cmp::Ordering; |
| 17 | |
| 18 | extern crate flatbuffers; |
| 19 | use self::flatbuffers::EndianScalar; |
| 20 | |
| 21 | #[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 22 | pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0; |
| 23 | #[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 24 | pub const ENUM_MAX_OPTIONAL_BYTE: i8 = 2; |
| 25 | #[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 26 | #[allow(non_camel_case_types)] |
| 27 | pub const ENUM_VALUES_OPTIONAL_BYTE: [OptionalByte; 3] = [ |
| 28 | OptionalByte::None, |
| 29 | OptionalByte::One, |
| 30 | OptionalByte::Two, |
| 31 | ]; |
| 32 | |
| 33 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 34 | #[repr(transparent)] |
| 35 | pub struct OptionalByte(pub i8); |
| 36 | #[allow(non_upper_case_globals)] |
| 37 | impl OptionalByte { |
| 38 | pub const None: Self = Self(0); |
| 39 | pub const One: Self = Self(1); |
| 40 | pub const Two: Self = Self(2); |
| 41 | |
| 42 | pub const ENUM_MIN: i8 = 0; |
| 43 | pub const ENUM_MAX: i8 = 2; |
| 44 | pub const ENUM_VALUES: &'static [Self] = &[ |
| 45 | Self::None, |
| 46 | Self::One, |
| 47 | Self::Two, |
| 48 | ]; |
| 49 | /// Returns the variant's name or "" if unknown. |
| 50 | pub fn variant_name(self) -> Option<&'static str> { |
| 51 | match self { |
| 52 | Self::None => Some("None"), |
| 53 | Self::One => Some("One"), |
| 54 | Self::Two => Some("Two"), |
| 55 | _ => None, |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | impl std::fmt::Debug for OptionalByte { |
| 60 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 61 | if let Some(name) = self.variant_name() { |
| 62 | f.write_str(name) |
| 63 | } else { |
| 64 | f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0)) |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | impl<'a> flatbuffers::Follow<'a> for OptionalByte { |
| 69 | type Inner = Self; |
| 70 | #[inline] |
| 71 | fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
| 72 | Self(flatbuffers::read_scalar_at::<i8>(buf, loc)) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | impl flatbuffers::Push for OptionalByte { |
| 77 | type Output = OptionalByte; |
| 78 | #[inline] |
| 79 | fn push(&self, dst: &mut [u8], _rest: &[u8]) { |
| 80 | flatbuffers::emplace_scalar::<i8>(dst, self.0); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | impl flatbuffers::EndianScalar for OptionalByte { |
| 85 | #[inline] |
| 86 | fn to_little_endian(self) -> Self { |
| 87 | Self(i8::to_le(self.0)) |
| 88 | } |
| 89 | #[inline] |
| 90 | fn from_little_endian(self) -> Self { |
| 91 | Self(i8::from_le(self.0)) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | pub enum ScalarStuffOffset {} |
| 96 | #[derive(Copy, Clone, PartialEq)] |
| 97 | |
| 98 | pub struct ScalarStuff<'a> { |
| 99 | pub _tab: flatbuffers::Table<'a>, |
| 100 | } |
| 101 | |
| 102 | impl<'a> flatbuffers::Follow<'a> for ScalarStuff<'a> { |
| 103 | type Inner = ScalarStuff<'a>; |
| 104 | #[inline] |
| 105 | fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
| 106 | Self { _tab: flatbuffers::Table { buf, loc } } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | impl<'a> ScalarStuff<'a> { |
| 111 | #[inline] |
| 112 | pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { |
| 113 | ScalarStuff { |
| 114 | _tab: table, |
| 115 | } |
| 116 | } |
| 117 | #[allow(unused_mut)] |
| 118 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( |
| 119 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, |
| 120 | args: &'args ScalarStuffArgs) -> flatbuffers::WIPOffset<ScalarStuff<'bldr>> { |
| 121 | let mut builder = ScalarStuffBuilder::new(_fbb); |
| 122 | builder.add_default_f64(args.default_f64); |
| 123 | if let Some(x) = args.maybe_f64 { builder.add_maybe_f64(x); } |
| 124 | builder.add_just_f64(args.just_f64); |
| 125 | builder.add_default_u64(args.default_u64); |
| 126 | if let Some(x) = args.maybe_u64 { builder.add_maybe_u64(x); } |
| 127 | builder.add_just_u64(args.just_u64); |
| 128 | builder.add_default_i64(args.default_i64); |
| 129 | if let Some(x) = args.maybe_i64 { builder.add_maybe_i64(x); } |
| 130 | builder.add_just_i64(args.just_i64); |
| 131 | builder.add_default_f32(args.default_f32); |
| 132 | if let Some(x) = args.maybe_f32 { builder.add_maybe_f32(x); } |
| 133 | builder.add_just_f32(args.just_f32); |
| 134 | builder.add_default_u32(args.default_u32); |
| 135 | if let Some(x) = args.maybe_u32 { builder.add_maybe_u32(x); } |
| 136 | builder.add_just_u32(args.just_u32); |
| 137 | builder.add_default_i32(args.default_i32); |
| 138 | if let Some(x) = args.maybe_i32 { builder.add_maybe_i32(x); } |
| 139 | builder.add_just_i32(args.just_i32); |
| 140 | builder.add_default_u16(args.default_u16); |
| 141 | if let Some(x) = args.maybe_u16 { builder.add_maybe_u16(x); } |
| 142 | builder.add_just_u16(args.just_u16); |
| 143 | builder.add_default_i16(args.default_i16); |
| 144 | if let Some(x) = args.maybe_i16 { builder.add_maybe_i16(x); } |
| 145 | builder.add_just_i16(args.just_i16); |
| 146 | builder.add_default_enum(args.default_enum); |
| 147 | if let Some(x) = args.maybe_enum { builder.add_maybe_enum(x); } |
| 148 | builder.add_just_enum(args.just_enum); |
| 149 | builder.add_default_bool(args.default_bool); |
| 150 | if let Some(x) = args.maybe_bool { builder.add_maybe_bool(x); } |
| 151 | builder.add_just_bool(args.just_bool); |
| 152 | builder.add_default_u8(args.default_u8); |
| 153 | if let Some(x) = args.maybe_u8 { builder.add_maybe_u8(x); } |
| 154 | builder.add_just_u8(args.just_u8); |
| 155 | builder.add_default_i8(args.default_i8); |
| 156 | if let Some(x) = args.maybe_i8 { builder.add_maybe_i8(x); } |
| 157 | builder.add_just_i8(args.just_i8); |
| 158 | builder.finish() |
| 159 | } |
| 160 | |
| 161 | pub const VT_JUST_I8: flatbuffers::VOffsetT = 4; |
| 162 | pub const VT_MAYBE_I8: flatbuffers::VOffsetT = 6; |
| 163 | pub const VT_DEFAULT_I8: flatbuffers::VOffsetT = 8; |
| 164 | pub const VT_JUST_U8: flatbuffers::VOffsetT = 10; |
| 165 | pub const VT_MAYBE_U8: flatbuffers::VOffsetT = 12; |
| 166 | pub const VT_DEFAULT_U8: flatbuffers::VOffsetT = 14; |
| 167 | pub const VT_JUST_I16: flatbuffers::VOffsetT = 16; |
| 168 | pub const VT_MAYBE_I16: flatbuffers::VOffsetT = 18; |
| 169 | pub const VT_DEFAULT_I16: flatbuffers::VOffsetT = 20; |
| 170 | pub const VT_JUST_U16: flatbuffers::VOffsetT = 22; |
| 171 | pub const VT_MAYBE_U16: flatbuffers::VOffsetT = 24; |
| 172 | pub const VT_DEFAULT_U16: flatbuffers::VOffsetT = 26; |
| 173 | pub const VT_JUST_I32: flatbuffers::VOffsetT = 28; |
| 174 | pub const VT_MAYBE_I32: flatbuffers::VOffsetT = 30; |
| 175 | pub const VT_DEFAULT_I32: flatbuffers::VOffsetT = 32; |
| 176 | pub const VT_JUST_U32: flatbuffers::VOffsetT = 34; |
| 177 | pub const VT_MAYBE_U32: flatbuffers::VOffsetT = 36; |
| 178 | pub const VT_DEFAULT_U32: flatbuffers::VOffsetT = 38; |
| 179 | pub const VT_JUST_I64: flatbuffers::VOffsetT = 40; |
| 180 | pub const VT_MAYBE_I64: flatbuffers::VOffsetT = 42; |
| 181 | pub const VT_DEFAULT_I64: flatbuffers::VOffsetT = 44; |
| 182 | pub const VT_JUST_U64: flatbuffers::VOffsetT = 46; |
| 183 | pub const VT_MAYBE_U64: flatbuffers::VOffsetT = 48; |
| 184 | pub const VT_DEFAULT_U64: flatbuffers::VOffsetT = 50; |
| 185 | pub const VT_JUST_F32: flatbuffers::VOffsetT = 52; |
| 186 | pub const VT_MAYBE_F32: flatbuffers::VOffsetT = 54; |
| 187 | pub const VT_DEFAULT_F32: flatbuffers::VOffsetT = 56; |
| 188 | pub const VT_JUST_F64: flatbuffers::VOffsetT = 58; |
| 189 | pub const VT_MAYBE_F64: flatbuffers::VOffsetT = 60; |
| 190 | pub const VT_DEFAULT_F64: flatbuffers::VOffsetT = 62; |
| 191 | pub const VT_JUST_BOOL: flatbuffers::VOffsetT = 64; |
| 192 | pub const VT_MAYBE_BOOL: flatbuffers::VOffsetT = 66; |
| 193 | pub const VT_DEFAULT_BOOL: flatbuffers::VOffsetT = 68; |
| 194 | pub const VT_JUST_ENUM: flatbuffers::VOffsetT = 70; |
| 195 | pub const VT_MAYBE_ENUM: flatbuffers::VOffsetT = 72; |
| 196 | pub const VT_DEFAULT_ENUM: flatbuffers::VOffsetT = 74; |
| 197 | |
| 198 | #[inline] |
| 199 | pub fn just_i8(&self) -> i8 { |
| 200 | self._tab.get::<i8>(ScalarStuff::VT_JUST_I8, Some(0)).unwrap() |
| 201 | } |
| 202 | #[inline] |
| 203 | pub fn maybe_i8(&self) -> Option<i8> { |
| 204 | self._tab.get::<i8>(ScalarStuff::VT_MAYBE_I8, None) |
| 205 | } |
| 206 | #[inline] |
| 207 | pub fn default_i8(&self) -> i8 { |
| 208 | self._tab.get::<i8>(ScalarStuff::VT_DEFAULT_I8, Some(42)).unwrap() |
| 209 | } |
| 210 | #[inline] |
| 211 | pub fn just_u8(&self) -> u8 { |
| 212 | self._tab.get::<u8>(ScalarStuff::VT_JUST_U8, Some(0)).unwrap() |
| 213 | } |
| 214 | #[inline] |
| 215 | pub fn maybe_u8(&self) -> Option<u8> { |
| 216 | self._tab.get::<u8>(ScalarStuff::VT_MAYBE_U8, None) |
| 217 | } |
| 218 | #[inline] |
| 219 | pub fn default_u8(&self) -> u8 { |
| 220 | self._tab.get::<u8>(ScalarStuff::VT_DEFAULT_U8, Some(42)).unwrap() |
| 221 | } |
| 222 | #[inline] |
| 223 | pub fn just_i16(&self) -> i16 { |
| 224 | self._tab.get::<i16>(ScalarStuff::VT_JUST_I16, Some(0)).unwrap() |
| 225 | } |
| 226 | #[inline] |
| 227 | pub fn maybe_i16(&self) -> Option<i16> { |
| 228 | self._tab.get::<i16>(ScalarStuff::VT_MAYBE_I16, None) |
| 229 | } |
| 230 | #[inline] |
| 231 | pub fn default_i16(&self) -> i16 { |
| 232 | self._tab.get::<i16>(ScalarStuff::VT_DEFAULT_I16, Some(42)).unwrap() |
| 233 | } |
| 234 | #[inline] |
| 235 | pub fn just_u16(&self) -> u16 { |
| 236 | self._tab.get::<u16>(ScalarStuff::VT_JUST_U16, Some(0)).unwrap() |
| 237 | } |
| 238 | #[inline] |
| 239 | pub fn maybe_u16(&self) -> Option<u16> { |
| 240 | self._tab.get::<u16>(ScalarStuff::VT_MAYBE_U16, None) |
| 241 | } |
| 242 | #[inline] |
| 243 | pub fn default_u16(&self) -> u16 { |
| 244 | self._tab.get::<u16>(ScalarStuff::VT_DEFAULT_U16, Some(42)).unwrap() |
| 245 | } |
| 246 | #[inline] |
| 247 | pub fn just_i32(&self) -> i32 { |
| 248 | self._tab.get::<i32>(ScalarStuff::VT_JUST_I32, Some(0)).unwrap() |
| 249 | } |
| 250 | #[inline] |
| 251 | pub fn maybe_i32(&self) -> Option<i32> { |
| 252 | self._tab.get::<i32>(ScalarStuff::VT_MAYBE_I32, None) |
| 253 | } |
| 254 | #[inline] |
| 255 | pub fn default_i32(&self) -> i32 { |
| 256 | self._tab.get::<i32>(ScalarStuff::VT_DEFAULT_I32, Some(42)).unwrap() |
| 257 | } |
| 258 | #[inline] |
| 259 | pub fn just_u32(&self) -> u32 { |
| 260 | self._tab.get::<u32>(ScalarStuff::VT_JUST_U32, Some(0)).unwrap() |
| 261 | } |
| 262 | #[inline] |
| 263 | pub fn maybe_u32(&self) -> Option<u32> { |
| 264 | self._tab.get::<u32>(ScalarStuff::VT_MAYBE_U32, None) |
| 265 | } |
| 266 | #[inline] |
| 267 | pub fn default_u32(&self) -> u32 { |
| 268 | self._tab.get::<u32>(ScalarStuff::VT_DEFAULT_U32, Some(42)).unwrap() |
| 269 | } |
| 270 | #[inline] |
| 271 | pub fn just_i64(&self) -> i64 { |
| 272 | self._tab.get::<i64>(ScalarStuff::VT_JUST_I64, Some(0)).unwrap() |
| 273 | } |
| 274 | #[inline] |
| 275 | pub fn maybe_i64(&self) -> Option<i64> { |
| 276 | self._tab.get::<i64>(ScalarStuff::VT_MAYBE_I64, None) |
| 277 | } |
| 278 | #[inline] |
| 279 | pub fn default_i64(&self) -> i64 { |
| 280 | self._tab.get::<i64>(ScalarStuff::VT_DEFAULT_I64, Some(42)).unwrap() |
| 281 | } |
| 282 | #[inline] |
| 283 | pub fn just_u64(&self) -> u64 { |
| 284 | self._tab.get::<u64>(ScalarStuff::VT_JUST_U64, Some(0)).unwrap() |
| 285 | } |
| 286 | #[inline] |
| 287 | pub fn maybe_u64(&self) -> Option<u64> { |
| 288 | self._tab.get::<u64>(ScalarStuff::VT_MAYBE_U64, None) |
| 289 | } |
| 290 | #[inline] |
| 291 | pub fn default_u64(&self) -> u64 { |
| 292 | self._tab.get::<u64>(ScalarStuff::VT_DEFAULT_U64, Some(42)).unwrap() |
| 293 | } |
| 294 | #[inline] |
| 295 | pub fn just_f32(&self) -> f32 { |
| 296 | self._tab.get::<f32>(ScalarStuff::VT_JUST_F32, Some(0.0)).unwrap() |
| 297 | } |
| 298 | #[inline] |
| 299 | pub fn maybe_f32(&self) -> Option<f32> { |
| 300 | self._tab.get::<f32>(ScalarStuff::VT_MAYBE_F32, None) |
| 301 | } |
| 302 | #[inline] |
| 303 | pub fn default_f32(&self) -> f32 { |
| 304 | self._tab.get::<f32>(ScalarStuff::VT_DEFAULT_F32, Some(42.0)).unwrap() |
| 305 | } |
| 306 | #[inline] |
| 307 | pub fn just_f64(&self) -> f64 { |
| 308 | self._tab.get::<f64>(ScalarStuff::VT_JUST_F64, Some(0.0)).unwrap() |
| 309 | } |
| 310 | #[inline] |
| 311 | pub fn maybe_f64(&self) -> Option<f64> { |
| 312 | self._tab.get::<f64>(ScalarStuff::VT_MAYBE_F64, None) |
| 313 | } |
| 314 | #[inline] |
| 315 | pub fn default_f64(&self) -> f64 { |
| 316 | self._tab.get::<f64>(ScalarStuff::VT_DEFAULT_F64, Some(42.0)).unwrap() |
| 317 | } |
| 318 | #[inline] |
| 319 | pub fn just_bool(&self) -> bool { |
| 320 | self._tab.get::<bool>(ScalarStuff::VT_JUST_BOOL, Some(false)).unwrap() |
| 321 | } |
| 322 | #[inline] |
| 323 | pub fn maybe_bool(&self) -> Option<bool> { |
| 324 | self._tab.get::<bool>(ScalarStuff::VT_MAYBE_BOOL, None) |
| 325 | } |
| 326 | #[inline] |
| 327 | pub fn default_bool(&self) -> bool { |
| 328 | self._tab.get::<bool>(ScalarStuff::VT_DEFAULT_BOOL, Some(true)).unwrap() |
| 329 | } |
| 330 | #[inline] |
| 331 | pub fn just_enum(&self) -> OptionalByte { |
| 332 | self._tab.get::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, Some(OptionalByte::None)).unwrap() |
| 333 | } |
| 334 | #[inline] |
| 335 | pub fn maybe_enum(&self) -> Option<OptionalByte> { |
| 336 | self._tab.get::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, None) |
| 337 | } |
| 338 | #[inline] |
| 339 | pub fn default_enum(&self) -> OptionalByte { |
| 340 | self._tab.get::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, Some(OptionalByte::One)).unwrap() |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | pub struct ScalarStuffArgs { |
| 345 | pub just_i8: i8, |
| 346 | pub maybe_i8: Option<i8>, |
| 347 | pub default_i8: i8, |
| 348 | pub just_u8: u8, |
| 349 | pub maybe_u8: Option<u8>, |
| 350 | pub default_u8: u8, |
| 351 | pub just_i16: i16, |
| 352 | pub maybe_i16: Option<i16>, |
| 353 | pub default_i16: i16, |
| 354 | pub just_u16: u16, |
| 355 | pub maybe_u16: Option<u16>, |
| 356 | pub default_u16: u16, |
| 357 | pub just_i32: i32, |
| 358 | pub maybe_i32: Option<i32>, |
| 359 | pub default_i32: i32, |
| 360 | pub just_u32: u32, |
| 361 | pub maybe_u32: Option<u32>, |
| 362 | pub default_u32: u32, |
| 363 | pub just_i64: i64, |
| 364 | pub maybe_i64: Option<i64>, |
| 365 | pub default_i64: i64, |
| 366 | pub just_u64: u64, |
| 367 | pub maybe_u64: Option<u64>, |
| 368 | pub default_u64: u64, |
| 369 | pub just_f32: f32, |
| 370 | pub maybe_f32: Option<f32>, |
| 371 | pub default_f32: f32, |
| 372 | pub just_f64: f64, |
| 373 | pub maybe_f64: Option<f64>, |
| 374 | pub default_f64: f64, |
| 375 | pub just_bool: bool, |
| 376 | pub maybe_bool: Option<bool>, |
| 377 | pub default_bool: bool, |
| 378 | pub just_enum: OptionalByte, |
| 379 | pub maybe_enum: Option<OptionalByte>, |
| 380 | pub default_enum: OptionalByte, |
| 381 | } |
| 382 | impl<'a> Default for ScalarStuffArgs { |
| 383 | #[inline] |
| 384 | fn default() -> Self { |
| 385 | ScalarStuffArgs { |
| 386 | just_i8: 0, |
| 387 | maybe_i8: None, |
| 388 | default_i8: 42, |
| 389 | just_u8: 0, |
| 390 | maybe_u8: None, |
| 391 | default_u8: 42, |
| 392 | just_i16: 0, |
| 393 | maybe_i16: None, |
| 394 | default_i16: 42, |
| 395 | just_u16: 0, |
| 396 | maybe_u16: None, |
| 397 | default_u16: 42, |
| 398 | just_i32: 0, |
| 399 | maybe_i32: None, |
| 400 | default_i32: 42, |
| 401 | just_u32: 0, |
| 402 | maybe_u32: None, |
| 403 | default_u32: 42, |
| 404 | just_i64: 0, |
| 405 | maybe_i64: None, |
| 406 | default_i64: 42, |
| 407 | just_u64: 0, |
| 408 | maybe_u64: None, |
| 409 | default_u64: 42, |
| 410 | just_f32: 0.0, |
| 411 | maybe_f32: None, |
| 412 | default_f32: 42.0, |
| 413 | just_f64: 0.0, |
| 414 | maybe_f64: None, |
| 415 | default_f64: 42.0, |
| 416 | just_bool: false, |
| 417 | maybe_bool: None, |
| 418 | default_bool: true, |
| 419 | just_enum: OptionalByte::None, |
| 420 | maybe_enum: None, |
| 421 | default_enum: OptionalByte::One, |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | pub struct ScalarStuffBuilder<'a: 'b, 'b> { |
| 426 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 427 | start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, |
| 428 | } |
| 429 | impl<'a: 'b, 'b> ScalarStuffBuilder<'a, 'b> { |
| 430 | #[inline] |
| 431 | pub fn add_just_i8(&mut self, just_i8: i8) { |
| 432 | self.fbb_.push_slot::<i8>(ScalarStuff::VT_JUST_I8, just_i8, 0); |
| 433 | } |
| 434 | #[inline] |
| 435 | pub fn add_maybe_i8(&mut self, maybe_i8: i8) { |
| 436 | self.fbb_.push_slot_always::<i8>(ScalarStuff::VT_MAYBE_I8, maybe_i8); |
| 437 | } |
| 438 | #[inline] |
| 439 | pub fn add_default_i8(&mut self, default_i8: i8) { |
| 440 | self.fbb_.push_slot::<i8>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42); |
| 441 | } |
| 442 | #[inline] |
| 443 | pub fn add_just_u8(&mut self, just_u8: u8) { |
| 444 | self.fbb_.push_slot::<u8>(ScalarStuff::VT_JUST_U8, just_u8, 0); |
| 445 | } |
| 446 | #[inline] |
| 447 | pub fn add_maybe_u8(&mut self, maybe_u8: u8) { |
| 448 | self.fbb_.push_slot_always::<u8>(ScalarStuff::VT_MAYBE_U8, maybe_u8); |
| 449 | } |
| 450 | #[inline] |
| 451 | pub fn add_default_u8(&mut self, default_u8: u8) { |
| 452 | self.fbb_.push_slot::<u8>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42); |
| 453 | } |
| 454 | #[inline] |
| 455 | pub fn add_just_i16(&mut self, just_i16: i16) { |
| 456 | self.fbb_.push_slot::<i16>(ScalarStuff::VT_JUST_I16, just_i16, 0); |
| 457 | } |
| 458 | #[inline] |
| 459 | pub fn add_maybe_i16(&mut self, maybe_i16: i16) { |
| 460 | self.fbb_.push_slot_always::<i16>(ScalarStuff::VT_MAYBE_I16, maybe_i16); |
| 461 | } |
| 462 | #[inline] |
| 463 | pub fn add_default_i16(&mut self, default_i16: i16) { |
| 464 | self.fbb_.push_slot::<i16>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42); |
| 465 | } |
| 466 | #[inline] |
| 467 | pub fn add_just_u16(&mut self, just_u16: u16) { |
| 468 | self.fbb_.push_slot::<u16>(ScalarStuff::VT_JUST_U16, just_u16, 0); |
| 469 | } |
| 470 | #[inline] |
| 471 | pub fn add_maybe_u16(&mut self, maybe_u16: u16) { |
| 472 | self.fbb_.push_slot_always::<u16>(ScalarStuff::VT_MAYBE_U16, maybe_u16); |
| 473 | } |
| 474 | #[inline] |
| 475 | pub fn add_default_u16(&mut self, default_u16: u16) { |
| 476 | self.fbb_.push_slot::<u16>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42); |
| 477 | } |
| 478 | #[inline] |
| 479 | pub fn add_just_i32(&mut self, just_i32: i32) { |
| 480 | self.fbb_.push_slot::<i32>(ScalarStuff::VT_JUST_I32, just_i32, 0); |
| 481 | } |
| 482 | #[inline] |
| 483 | pub fn add_maybe_i32(&mut self, maybe_i32: i32) { |
| 484 | self.fbb_.push_slot_always::<i32>(ScalarStuff::VT_MAYBE_I32, maybe_i32); |
| 485 | } |
| 486 | #[inline] |
| 487 | pub fn add_default_i32(&mut self, default_i32: i32) { |
| 488 | self.fbb_.push_slot::<i32>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42); |
| 489 | } |
| 490 | #[inline] |
| 491 | pub fn add_just_u32(&mut self, just_u32: u32) { |
| 492 | self.fbb_.push_slot::<u32>(ScalarStuff::VT_JUST_U32, just_u32, 0); |
| 493 | } |
| 494 | #[inline] |
| 495 | pub fn add_maybe_u32(&mut self, maybe_u32: u32) { |
| 496 | self.fbb_.push_slot_always::<u32>(ScalarStuff::VT_MAYBE_U32, maybe_u32); |
| 497 | } |
| 498 | #[inline] |
| 499 | pub fn add_default_u32(&mut self, default_u32: u32) { |
| 500 | self.fbb_.push_slot::<u32>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42); |
| 501 | } |
| 502 | #[inline] |
| 503 | pub fn add_just_i64(&mut self, just_i64: i64) { |
| 504 | self.fbb_.push_slot::<i64>(ScalarStuff::VT_JUST_I64, just_i64, 0); |
| 505 | } |
| 506 | #[inline] |
| 507 | pub fn add_maybe_i64(&mut self, maybe_i64: i64) { |
| 508 | self.fbb_.push_slot_always::<i64>(ScalarStuff::VT_MAYBE_I64, maybe_i64); |
| 509 | } |
| 510 | #[inline] |
| 511 | pub fn add_default_i64(&mut self, default_i64: i64) { |
| 512 | self.fbb_.push_slot::<i64>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42); |
| 513 | } |
| 514 | #[inline] |
| 515 | pub fn add_just_u64(&mut self, just_u64: u64) { |
| 516 | self.fbb_.push_slot::<u64>(ScalarStuff::VT_JUST_U64, just_u64, 0); |
| 517 | } |
| 518 | #[inline] |
| 519 | pub fn add_maybe_u64(&mut self, maybe_u64: u64) { |
| 520 | self.fbb_.push_slot_always::<u64>(ScalarStuff::VT_MAYBE_U64, maybe_u64); |
| 521 | } |
| 522 | #[inline] |
| 523 | pub fn add_default_u64(&mut self, default_u64: u64) { |
| 524 | self.fbb_.push_slot::<u64>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42); |
| 525 | } |
| 526 | #[inline] |
| 527 | pub fn add_just_f32(&mut self, just_f32: f32) { |
| 528 | self.fbb_.push_slot::<f32>(ScalarStuff::VT_JUST_F32, just_f32, 0.0); |
| 529 | } |
| 530 | #[inline] |
| 531 | pub fn add_maybe_f32(&mut self, maybe_f32: f32) { |
| 532 | self.fbb_.push_slot_always::<f32>(ScalarStuff::VT_MAYBE_F32, maybe_f32); |
| 533 | } |
| 534 | #[inline] |
| 535 | pub fn add_default_f32(&mut self, default_f32: f32) { |
| 536 | self.fbb_.push_slot::<f32>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0); |
| 537 | } |
| 538 | #[inline] |
| 539 | pub fn add_just_f64(&mut self, just_f64: f64) { |
| 540 | self.fbb_.push_slot::<f64>(ScalarStuff::VT_JUST_F64, just_f64, 0.0); |
| 541 | } |
| 542 | #[inline] |
| 543 | pub fn add_maybe_f64(&mut self, maybe_f64: f64) { |
| 544 | self.fbb_.push_slot_always::<f64>(ScalarStuff::VT_MAYBE_F64, maybe_f64); |
| 545 | } |
| 546 | #[inline] |
| 547 | pub fn add_default_f64(&mut self, default_f64: f64) { |
| 548 | self.fbb_.push_slot::<f64>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0); |
| 549 | } |
| 550 | #[inline] |
| 551 | pub fn add_just_bool(&mut self, just_bool: bool) { |
| 552 | self.fbb_.push_slot::<bool>(ScalarStuff::VT_JUST_BOOL, just_bool, false); |
| 553 | } |
| 554 | #[inline] |
| 555 | pub fn add_maybe_bool(&mut self, maybe_bool: bool) { |
| 556 | self.fbb_.push_slot_always::<bool>(ScalarStuff::VT_MAYBE_BOOL, maybe_bool); |
| 557 | } |
| 558 | #[inline] |
| 559 | pub fn add_default_bool(&mut self, default_bool: bool) { |
| 560 | self.fbb_.push_slot::<bool>(ScalarStuff::VT_DEFAULT_BOOL, default_bool, true); |
| 561 | } |
| 562 | #[inline] |
| 563 | pub fn add_just_enum(&mut self, just_enum: OptionalByte) { |
| 564 | self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, just_enum, OptionalByte::None); |
| 565 | } |
| 566 | #[inline] |
| 567 | pub fn add_maybe_enum(&mut self, maybe_enum: OptionalByte) { |
| 568 | self.fbb_.push_slot_always::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, maybe_enum); |
| 569 | } |
| 570 | #[inline] |
| 571 | pub fn add_default_enum(&mut self, default_enum: OptionalByte) { |
| 572 | self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, default_enum, OptionalByte::One); |
| 573 | } |
| 574 | #[inline] |
| 575 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ScalarStuffBuilder<'a, 'b> { |
| 576 | let start = _fbb.start_table(); |
| 577 | ScalarStuffBuilder { |
| 578 | fbb_: _fbb, |
| 579 | start_: start, |
| 580 | } |
| 581 | } |
| 582 | #[inline] |
| 583 | pub fn finish(self) -> flatbuffers::WIPOffset<ScalarStuff<'a>> { |
| 584 | let o = self.fbb_.end_table(self.start_); |
| 585 | flatbuffers::WIPOffset::new(o.value()) |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | impl std::fmt::Debug for ScalarStuff<'_> { |
| 590 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 591 | let mut ds = f.debug_struct("ScalarStuff"); |
| 592 | ds.field("just_i8", &self.just_i8()); |
| 593 | ds.field("maybe_i8", &self.maybe_i8()); |
| 594 | ds.field("default_i8", &self.default_i8()); |
| 595 | ds.field("just_u8", &self.just_u8()); |
| 596 | ds.field("maybe_u8", &self.maybe_u8()); |
| 597 | ds.field("default_u8", &self.default_u8()); |
| 598 | ds.field("just_i16", &self.just_i16()); |
| 599 | ds.field("maybe_i16", &self.maybe_i16()); |
| 600 | ds.field("default_i16", &self.default_i16()); |
| 601 | ds.field("just_u16", &self.just_u16()); |
| 602 | ds.field("maybe_u16", &self.maybe_u16()); |
| 603 | ds.field("default_u16", &self.default_u16()); |
| 604 | ds.field("just_i32", &self.just_i32()); |
| 605 | ds.field("maybe_i32", &self.maybe_i32()); |
| 606 | ds.field("default_i32", &self.default_i32()); |
| 607 | ds.field("just_u32", &self.just_u32()); |
| 608 | ds.field("maybe_u32", &self.maybe_u32()); |
| 609 | ds.field("default_u32", &self.default_u32()); |
| 610 | ds.field("just_i64", &self.just_i64()); |
| 611 | ds.field("maybe_i64", &self.maybe_i64()); |
| 612 | ds.field("default_i64", &self.default_i64()); |
| 613 | ds.field("just_u64", &self.just_u64()); |
| 614 | ds.field("maybe_u64", &self.maybe_u64()); |
| 615 | ds.field("default_u64", &self.default_u64()); |
| 616 | ds.field("just_f32", &self.just_f32()); |
| 617 | ds.field("maybe_f32", &self.maybe_f32()); |
| 618 | ds.field("default_f32", &self.default_f32()); |
| 619 | ds.field("just_f64", &self.just_f64()); |
| 620 | ds.field("maybe_f64", &self.maybe_f64()); |
| 621 | ds.field("default_f64", &self.default_f64()); |
| 622 | ds.field("just_bool", &self.just_bool()); |
| 623 | ds.field("maybe_bool", &self.maybe_bool()); |
| 624 | ds.field("default_bool", &self.default_bool()); |
| 625 | ds.field("just_enum", &self.just_enum()); |
| 626 | ds.field("maybe_enum", &self.maybe_enum()); |
| 627 | ds.field("default_enum", &self.default_enum()); |
| 628 | ds.finish() |
| 629 | } |
| 630 | } |
| 631 | #[inline] |
| 632 | pub fn get_root_as_scalar_stuff<'a>(buf: &'a [u8]) -> ScalarStuff<'a> { |
| 633 | flatbuffers::get_root::<ScalarStuff<'a>>(buf) |
| 634 | } |
| 635 | |
| 636 | #[inline] |
| 637 | pub fn get_size_prefixed_root_as_scalar_stuff<'a>(buf: &'a [u8]) -> ScalarStuff<'a> { |
| 638 | flatbuffers::get_size_prefixed_root::<ScalarStuff<'a>>(buf) |
| 639 | } |
| 640 | |
| 641 | pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL"; |
| 642 | |
| 643 | #[inline] |
| 644 | pub fn scalar_stuff_buffer_has_identifier(buf: &[u8]) -> bool { |
| 645 | flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, false) |
| 646 | } |
| 647 | |
| 648 | #[inline] |
| 649 | pub fn scalar_stuff_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool { |
| 650 | flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, true) |
| 651 | } |
| 652 | |
| 653 | pub const SCALAR_STUFF_EXTENSION: &str = "mon"; |
| 654 | |
| 655 | #[inline] |
| 656 | pub fn finish_scalar_stuff_buffer<'a, 'b>( |
| 657 | fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 658 | root: flatbuffers::WIPOffset<ScalarStuff<'a>>) { |
| 659 | fbb.finish(root, Some(SCALAR_STUFF_IDENTIFIER)); |
| 660 | } |
| 661 | |
| 662 | #[inline] |
| 663 | pub fn finish_size_prefixed_scalar_stuff_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<ScalarStuff<'a>>) { |
| 664 | fbb.finish_size_prefixed(root, Some(SCALAR_STUFF_IDENTIFIER)); |
| 665 | } |
| 666 | } // pub mod optional_scalars |
| 667 | |