James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 2 | // @generated |
| 3 | extern crate alloc; |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 4 | extern crate flatbuffers; |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 5 | use alloc::boxed::Box; |
| 6 | use alloc::string::{String, ToString}; |
| 7 | use alloc::vec::Vec; |
| 8 | use core::mem; |
| 9 | use core::cmp::Ordering; |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 10 | use self::flatbuffers::{EndianScalar, Follow}; |
| 11 | use super::*; |
| 12 | pub enum TableAOffset {} |
| 13 | #[derive(Copy, Clone, PartialEq)] |
| 14 | |
| 15 | pub struct TableA<'a> { |
| 16 | pub _tab: flatbuffers::Table<'a>, |
| 17 | } |
| 18 | |
| 19 | impl<'a> flatbuffers::Follow<'a> for TableA<'a> { |
| 20 | type Inner = TableA<'a>; |
| 21 | #[inline] |
| 22 | fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
| 23 | Self { _tab: flatbuffers::Table { buf, loc } } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | impl<'a> TableA<'a> { |
| 28 | pub const VT_B: flatbuffers::VOffsetT = 4; |
| 29 | |
| 30 | pub const fn get_fully_qualified_name() -> &'static str { |
| 31 | "TableA" |
| 32 | } |
| 33 | |
| 34 | #[inline] |
| 35 | pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { |
| 36 | TableA { _tab: table } |
| 37 | } |
| 38 | #[allow(unused_mut)] |
| 39 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( |
| 40 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, |
| 41 | args: &'args TableAArgs<'args> |
| 42 | ) -> flatbuffers::WIPOffset<TableA<'bldr>> { |
| 43 | let mut builder = TableABuilder::new(_fbb); |
| 44 | if let Some(x) = args.b { builder.add_b(x); } |
| 45 | builder.finish() |
| 46 | } |
| 47 | |
| 48 | pub fn unpack(&self) -> TableAT { |
| 49 | let b = self.b().map(|x| { |
| 50 | Box::new(x.unpack()) |
| 51 | }); |
| 52 | TableAT { |
| 53 | b, |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | #[inline] |
| 58 | pub fn b(&self) -> Option<my_game::other_name_space::TableB<'a>> { |
| 59 | self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | impl flatbuffers::Verifiable for TableA<'_> { |
| 64 | #[inline] |
| 65 | fn run_verifier( |
| 66 | v: &mut flatbuffers::Verifier, pos: usize |
| 67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> { |
| 68 | use self::flatbuffers::Verifiable; |
| 69 | v.visit_table(pos)? |
| 70 | .visit_field::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)? |
| 71 | .finish(); |
| 72 | Ok(()) |
| 73 | } |
| 74 | } |
| 75 | pub struct TableAArgs<'a> { |
| 76 | pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, |
| 77 | } |
| 78 | impl<'a> Default for TableAArgs<'a> { |
| 79 | #[inline] |
| 80 | fn default() -> Self { |
| 81 | TableAArgs { |
| 82 | b: None, |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | pub struct TableABuilder<'a: 'b, 'b> { |
| 88 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 89 | start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, |
| 90 | } |
| 91 | impl<'a: 'b, 'b> TableABuilder<'a, 'b> { |
| 92 | #[inline] |
| 93 | pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { |
| 94 | self.fbb_.push_slot_always::<flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); |
| 95 | } |
| 96 | #[inline] |
| 97 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableABuilder<'a, 'b> { |
| 98 | let start = _fbb.start_table(); |
| 99 | TableABuilder { |
| 100 | fbb_: _fbb, |
| 101 | start_: start, |
| 102 | } |
| 103 | } |
| 104 | #[inline] |
| 105 | pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> { |
| 106 | let o = self.fbb_.end_table(self.start_); |
| 107 | flatbuffers::WIPOffset::new(o.value()) |
| 108 | } |
| 109 | } |
| 110 | |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 111 | impl core::fmt::Debug for TableA<'_> { |
| 112 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 113 | let mut ds = f.debug_struct("TableA"); |
| 114 | ds.field("b", &self.b()); |
| 115 | ds.finish() |
| 116 | } |
| 117 | } |
| 118 | #[non_exhaustive] |
| 119 | #[derive(Debug, Clone, PartialEq)] |
| 120 | pub struct TableAT { |
| 121 | pub b: Option<Box<my_game::other_name_space::TableBT>>, |
| 122 | } |
| 123 | impl Default for TableAT { |
| 124 | fn default() -> Self { |
| 125 | Self { |
| 126 | b: None, |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | impl TableAT { |
| 131 | pub fn pack<'b>( |
| 132 | &self, |
| 133 | _fbb: &mut flatbuffers::FlatBufferBuilder<'b> |
| 134 | ) -> flatbuffers::WIPOffset<TableA<'b>> { |
| 135 | let b = self.b.as_ref().map(|x|{ |
| 136 | x.pack(_fbb) |
| 137 | }); |
| 138 | TableA::create(_fbb, &TableAArgs{ |
| 139 | b, |
| 140 | }) |
| 141 | } |
| 142 | } |