|
| 1 | +// automatically generated by the FlatBuffers compiler, do not modify |
| 2 | + |
| 3 | +// @generated |
| 4 | + |
| 5 | +extern crate flatbuffers; |
| 6 | + |
| 7 | +#[allow(unused_imports, dead_code)] |
| 8 | +pub mod metadata { |
| 9 | + |
| 10 | + use core::cmp::Ordering; |
| 11 | + use core::mem; |
| 12 | + |
| 13 | + extern crate flatbuffers; |
| 14 | + use self::flatbuffers::{EndianScalar, Follow}; |
| 15 | + |
| 16 | + pub enum MetadataOffset {} |
| 17 | + #[derive(Copy, Clone, PartialEq)] |
| 18 | + |
| 19 | + pub struct Metadata<'a> { |
| 20 | + pub _tab: flatbuffers::Table<'a>, |
| 21 | + } |
| 22 | + |
| 23 | + impl<'a> flatbuffers::Follow<'a> for Metadata<'a> { |
| 24 | + type Inner = Metadata<'a>; |
| 25 | + #[inline] |
| 26 | + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
| 27 | + Self { |
| 28 | + _tab: flatbuffers::Table::new(buf, loc), |
| 29 | + } |
| 30 | + } |
| 31 | + } |
| 32 | + |
| 33 | + impl<'a> Metadata<'a> { |
| 34 | + pub const VT_SEND_ERRORS: flatbuffers::VOffsetT = 4; |
| 35 | + |
| 36 | + #[inline] |
| 37 | + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { |
| 38 | + Metadata { _tab: table } |
| 39 | + } |
| 40 | + #[allow(unused_mut)] |
| 41 | + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( |
| 42 | + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, |
| 43 | + args: &'args MetadataArgs, |
| 44 | + ) -> flatbuffers::WIPOffset<Metadata<'bldr>> { |
| 45 | + let mut builder = MetadataBuilder::new(_fbb); |
| 46 | + builder.add_send_errors(args.send_errors); |
| 47 | + builder.finish() |
| 48 | + } |
| 49 | + |
| 50 | + #[inline] |
| 51 | + pub fn send_errors(&self) -> u64 { |
| 52 | + // Safety: |
| 53 | + // Created from valid Table for this object |
| 54 | + // which contains a valid value in this slot |
| 55 | + unsafe { |
| 56 | + self._tab |
| 57 | + .get::<u64>(Metadata::VT_SEND_ERRORS, Some(0)) |
| 58 | + .unwrap() |
| 59 | + } |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + impl flatbuffers::Verifiable for Metadata<'_> { |
| 64 | + #[inline] |
| 65 | + fn run_verifier( |
| 66 | + v: &mut flatbuffers::Verifier, |
| 67 | + pos: usize, |
| 68 | + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { |
| 69 | + use self::flatbuffers::Verifiable; |
| 70 | + v.visit_table(pos)? |
| 71 | + .visit_field::<u64>("send_errors", Self::VT_SEND_ERRORS, false)? |
| 72 | + .finish(); |
| 73 | + Ok(()) |
| 74 | + } |
| 75 | + } |
| 76 | + pub struct MetadataArgs { |
| 77 | + pub send_errors: u64, |
| 78 | + } |
| 79 | + impl<'a> Default for MetadataArgs { |
| 80 | + #[inline] |
| 81 | + fn default() -> Self { |
| 82 | + MetadataArgs { send_errors: 0 } |
| 83 | + } |
| 84 | + } |
| 85 | + |
| 86 | + pub struct MetadataBuilder<'a: 'b, 'b> { |
| 87 | + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 88 | + start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, |
| 89 | + } |
| 90 | + impl<'a: 'b, 'b> MetadataBuilder<'a, 'b> { |
| 91 | + #[inline] |
| 92 | + pub fn add_send_errors(&mut self, send_errors: u64) { |
| 93 | + self.fbb_ |
| 94 | + .push_slot::<u64>(Metadata::VT_SEND_ERRORS, send_errors, 0); |
| 95 | + } |
| 96 | + #[inline] |
| 97 | + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MetadataBuilder<'a, 'b> { |
| 98 | + let start = _fbb.start_table(); |
| 99 | + MetadataBuilder { |
| 100 | + fbb_: _fbb, |
| 101 | + start_: start, |
| 102 | + } |
| 103 | + } |
| 104 | + #[inline] |
| 105 | + pub fn finish(self) -> flatbuffers::WIPOffset<Metadata<'a>> { |
| 106 | + let o = self.fbb_.end_table(self.start_); |
| 107 | + flatbuffers::WIPOffset::new(o.value()) |
| 108 | + } |
| 109 | + } |
| 110 | + |
| 111 | + impl core::fmt::Debug for Metadata<'_> { |
| 112 | + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
| 113 | + let mut ds = f.debug_struct("Metadata"); |
| 114 | + ds.field("send_errors", &self.send_errors()); |
| 115 | + ds.finish() |
| 116 | + } |
| 117 | + } |
| 118 | + #[inline] |
| 119 | + /// Verifies that a buffer of bytes contains a `Metadata` |
| 120 | + /// and returns it. |
| 121 | + /// Note that verification is still experimental and may not |
| 122 | + /// catch every error, or be maximally performant. For the |
| 123 | + /// previous, unchecked, behavior use |
| 124 | + /// `root_as_metadata_unchecked`. |
| 125 | + pub fn root_as_metadata(buf: &[u8]) -> Result<Metadata, flatbuffers::InvalidFlatbuffer> { |
| 126 | + flatbuffers::root::<Metadata>(buf) |
| 127 | + } |
| 128 | + #[inline] |
| 129 | + /// Verifies that a buffer of bytes contains a size prefixed |
| 130 | + /// `Metadata` and returns it. |
| 131 | + /// Note that verification is still experimental and may not |
| 132 | + /// catch every error, or be maximally performant. For the |
| 133 | + /// previous, unchecked, behavior use |
| 134 | + /// `size_prefixed_root_as_metadata_unchecked`. |
| 135 | + pub fn size_prefixed_root_as_metadata( |
| 136 | + buf: &[u8], |
| 137 | + ) -> Result<Metadata, flatbuffers::InvalidFlatbuffer> { |
| 138 | + flatbuffers::size_prefixed_root::<Metadata>(buf) |
| 139 | + } |
| 140 | + #[inline] |
| 141 | + /// Verifies, with the given options, that a buffer of bytes |
| 142 | + /// contains a `Metadata` and returns it. |
| 143 | + /// Note that verification is still experimental and may not |
| 144 | + /// catch every error, or be maximally performant. For the |
| 145 | + /// previous, unchecked, behavior use |
| 146 | + /// `root_as_metadata_unchecked`. |
| 147 | + pub fn root_as_metadata_with_opts<'b, 'o>( |
| 148 | + opts: &'o flatbuffers::VerifierOptions, |
| 149 | + buf: &'b [u8], |
| 150 | + ) -> Result<Metadata<'b>, flatbuffers::InvalidFlatbuffer> { |
| 151 | + flatbuffers::root_with_opts::<Metadata<'b>>(opts, buf) |
| 152 | + } |
| 153 | + #[inline] |
| 154 | + /// Verifies, with the given verifier options, that a buffer of |
| 155 | + /// bytes contains a size prefixed `Metadata` and returns |
| 156 | + /// it. Note that verification is still experimental and may not |
| 157 | + /// catch every error, or be maximally performant. For the |
| 158 | + /// previous, unchecked, behavior use |
| 159 | + /// `root_as_metadata_unchecked`. |
| 160 | + pub fn size_prefixed_root_as_metadata_with_opts<'b, 'o>( |
| 161 | + opts: &'o flatbuffers::VerifierOptions, |
| 162 | + buf: &'b [u8], |
| 163 | + ) -> Result<Metadata<'b>, flatbuffers::InvalidFlatbuffer> { |
| 164 | + flatbuffers::size_prefixed_root_with_opts::<Metadata<'b>>(opts, buf) |
| 165 | + } |
| 166 | + #[inline] |
| 167 | + /// Assumes, without verification, that a buffer of bytes contains a Metadata and returns it. |
| 168 | + /// # Safety |
| 169 | + /// Callers must trust the given bytes do indeed contain a valid `Metadata`. |
| 170 | + pub unsafe fn root_as_metadata_unchecked(buf: &[u8]) -> Metadata { |
| 171 | + flatbuffers::root_unchecked::<Metadata>(buf) |
| 172 | + } |
| 173 | + #[inline] |
| 174 | + /// Assumes, without verification, that a buffer of bytes contains a size prefixed Metadata and returns it. |
| 175 | + /// # Safety |
| 176 | + /// Callers must trust the given bytes do indeed contain a valid size prefixed `Metadata`. |
| 177 | + pub unsafe fn size_prefixed_root_as_metadata_unchecked(buf: &[u8]) -> Metadata { |
| 178 | + flatbuffers::size_prefixed_root_unchecked::<Metadata>(buf) |
| 179 | + } |
| 180 | + #[inline] |
| 181 | + pub fn finish_metadata_buffer<'a, 'b>( |
| 182 | + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 183 | + root: flatbuffers::WIPOffset<Metadata<'a>>, |
| 184 | + ) { |
| 185 | + fbb.finish(root, None); |
| 186 | + } |
| 187 | + |
| 188 | + #[inline] |
| 189 | + pub fn finish_size_prefixed_metadata_buffer<'a, 'b>( |
| 190 | + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, |
| 191 | + root: flatbuffers::WIPOffset<Metadata<'a>>, |
| 192 | + ) { |
| 193 | + fbb.finish_size_prefixed(root, None); |
| 194 | + } |
| 195 | +} // pub mod Metadata |
0 commit comments