...

Text file src/github.com/google/flatbuffers/tests/monster_test/my_game/example_2/monster_generated.rs

Documentation: github.com/google/flatbuffers/tests/monster_test/my_game/example_2

     1// automatically generated by the FlatBuffers compiler, do not modify
     2// @generated
     3extern crate alloc;
     4extern crate flatbuffers;
     5use alloc::boxed::Box;
     6use alloc::string::{String, ToString};
     7use alloc::vec::Vec;
     8use core::mem;
     9use core::cmp::Ordering;
    10use self::flatbuffers::{EndianScalar, Follow};
    11use super::*;
    12pub enum MonsterOffset {}
    13#[derive(Copy, Clone, PartialEq)]
    14
    15pub struct Monster<'a> {
    16  pub _tab: flatbuffers::Table<'a>,
    17}
    18
    19impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
    20  type Inner = Monster<'a>;
    21  #[inline]
    22  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    23    Self { _tab: flatbuffers::Table::new(buf, loc) }
    24  }
    25}
    26
    27impl<'a> Monster<'a> {
    28
    29  pub const fn get_fully_qualified_name() -> &'static str {
    30    "MyGame.Example2.Monster"
    31  }
    32
    33  #[inline]
    34  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    35    Monster { _tab: table }
    36  }
    37  #[allow(unused_mut)]
    38  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    39    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    40    _args: &'args MonsterArgs
    41  ) -> flatbuffers::WIPOffset<Monster<'bldr>> {
    42    let mut builder = MonsterBuilder::new(_fbb);
    43    builder.finish()
    44  }
    45
    46  pub fn unpack(&self) -> MonsterT {
    47    MonsterT {
    48    }
    49  }
    50}
    51
    52impl flatbuffers::Verifiable for Monster<'_> {
    53  #[inline]
    54  fn run_verifier(
    55    v: &mut flatbuffers::Verifier, pos: usize
    56  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    57    use self::flatbuffers::Verifiable;
    58    v.visit_table(pos)?
    59     .finish();
    60    Ok(())
    61  }
    62}
    63pub struct MonsterArgs {
    64}
    65impl<'a> Default for MonsterArgs {
    66  #[inline]
    67  fn default() -> Self {
    68    MonsterArgs {
    69    }
    70  }
    71}
    72
    73pub struct MonsterBuilder<'a: 'b, 'b> {
    74  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    75  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
    76}
    77impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
    78  #[inline]
    79  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
    80    let start = _fbb.start_table();
    81    MonsterBuilder {
    82      fbb_: _fbb,
    83      start_: start,
    84    }
    85  }
    86  #[inline]
    87  pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
    88    let o = self.fbb_.end_table(self.start_);
    89    flatbuffers::WIPOffset::new(o.value())
    90  }
    91}
    92
    93impl core::fmt::Debug for Monster<'_> {
    94  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    95    let mut ds = f.debug_struct("Monster");
    96      ds.finish()
    97  }
    98}
    99#[non_exhaustive]
   100#[derive(Debug, Clone, PartialEq)]
   101pub struct MonsterT {
   102}
   103impl Default for MonsterT {
   104  fn default() -> Self {
   105    Self {
   106    }
   107  }
   108}
   109impl MonsterT {
   110  pub fn pack<'b>(
   111    &self,
   112    _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
   113  ) -> flatbuffers::WIPOffset<Monster<'b>> {
   114    Monster::create(_fbb, &MonsterArgs{
   115    })
   116  }
   117}

View as plain text