Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | // @generated |
| 3 | extern crate alloc; |
| 4 | extern crate flatbuffers; |
| 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; |
| 10 | use self::flatbuffers::{EndianScalar, Follow}; |
| 11 | use super::*; |
| 12 | pub(crate) enum AnnotationsOffset {} |
| 13 | #[derive(Copy, Clone, PartialEq)] |
| 14 | |
| 15 | pub(crate) struct Annotations<'a> { |
| 16 | pub _tab: flatbuffers::Table<'a>, |
| 17 | } |
| 18 | |
| 19 | impl<'a> flatbuffers::Follow<'a> for Annotations<'a> { |
| 20 | type Inner = Annotations<'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> Annotations<'a> { |
| 28 | pub const VT_VALUE: flatbuffers::VOffsetT = 4; |
| 29 | |
| 30 | pub const fn get_fully_qualified_name() -> &'static str { |
| 31 | "Annotations" |
| 32 | } |
| 33 | |
| 34 | #[inline] |
| 35 | pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { |
| 36 | Annotations { _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 AnnotationsArgs |
| 42 | ) -> flatbuffers::WIPOffset<Annotations<'bldr>> { |
| 43 | let mut builder = AnnotationsBuilder::new(_fbb); |
| 44 | builder.add_value(args.value); |
| 45 | builder.finish() |
| 46 | } |
| 47 | |
| 48 | pub fn unpack(&self) -> AnnotationsT { |
| 49 | let value = self.value(); |
| 50 | AnnotationsT { |
| 51 | value, |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | #[inline] |
| 56 | pub fn value(&self) -> i32 { |
| 57 | self._tab.get::<i32>(Annotations::VT_VALUE, Some(0)).unwrap() |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | impl flatbuffers::Verifiable for Annotations<'_> { |
| 62 | #[inline] |
| 63 | fn run_verifier( |
| 64 | v: &mut flatbuffers::Verifier, pos: usize |
| 65 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> { |
| 66 | use self::flatbuffers::Verifiable; |
| 67 | v.visit_table(pos)? |
| 68 | .visit_field::<i32>("value", Self::VT_VALUE, false)? |
| 69 | .finish(); |
| 70 | Ok(()) |
| 71 | } |
| 72 | } |
| 73 | pub(crate) struct AnnotationsArgs { |
| 74 | pub value: i32, |
| 75 | } |
| 76 | impl<'a> Default for AnnotationsArgs { |
| 77 | #[inline] |
| 78 | fn default() -> Self { |
| 79 | AnnotationsArgs { |
| 80 | value: 0, |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | pub(crate) struct AnnotationsBuilder<'a: 'b, 'b> { |
| 86 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 87 | start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, |
| 88 | } |
| 89 | impl<'a: 'b, 'b> AnnotationsBuilder<'a, 'b> { |
| 90 | #[inline] |
| 91 | pub fn add_value(&mut self, value: i32) { |
| 92 | self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0); |
| 93 | } |
| 94 | #[inline] |
| 95 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> AnnotationsBuilder<'a, 'b> { |
| 96 | let start = _fbb.start_table(); |
| 97 | AnnotationsBuilder { |
| 98 | fbb_: _fbb, |
| 99 | start_: start, |
| 100 | } |
| 101 | } |
| 102 | #[inline] |
| 103 | pub fn finish(self) -> flatbuffers::WIPOffset<Annotations<'a>> { |
| 104 | let o = self.fbb_.end_table(self.start_); |
| 105 | flatbuffers::WIPOffset::new(o.value()) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | impl core::fmt::Debug for Annotations<'_> { |
| 110 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
| 111 | let mut ds = f.debug_struct("Annotations"); |
| 112 | ds.field("value", &self.value()); |
| 113 | ds.finish() |
| 114 | } |
| 115 | } |
| 116 | #[non_exhaustive] |
| 117 | #[derive(Debug, Clone, PartialEq)] |
| 118 | pub(crate) struct AnnotationsT { |
| 119 | pub value: i32, |
| 120 | } |
| 121 | impl Default for AnnotationsT { |
| 122 | fn default() -> Self { |
| 123 | Self { |
| 124 | value: 0, |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | impl AnnotationsT { |
| 129 | pub fn pack<'b>( |
| 130 | &self, |
| 131 | _fbb: &mut flatbuffers::FlatBufferBuilder<'b> |
| 132 | ) -> flatbuffers::WIPOffset<Annotations<'b>> { |
| 133 | let value = self.value; |
| 134 | Annotations::create(_fbb, &AnnotationsArgs{ |
| 135 | value, |
| 136 | }) |
| 137 | } |
| 138 | } |