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