// automatically generated by the FlatBuffers compiler, do not modify


// @generated

use core::mem;
use core::cmp::Ordering;

extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};

pub enum AvatarLevelTemplateOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct AvatarLevelTemplate<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for AvatarLevelTemplate<'a> {
  type Inner = AvatarLevelTemplate<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> AvatarLevelTemplate<'a> {
  pub const VT_LEVEL: flatbuffers::VOffsetT = 4;
  pub const VT_EXP: flatbuffers::VOffsetT = 6;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    AvatarLevelTemplate { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args AvatarLevelTemplateArgs
  ) -> flatbuffers::WIPOffset<AvatarLevelTemplate<'bldr>> {
    let mut builder = AvatarLevelTemplateBuilder::new(_fbb);
    builder.add_exp(args.exp);
    builder.add_level(args.level);
    builder.finish()
  }


  #[inline]
  pub fn level(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(AvatarLevelTemplate::VT_LEVEL, Some(0)).unwrap()}
  }
  #[inline]
  pub fn exp(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(AvatarLevelTemplate::VT_EXP, Some(0)).unwrap()}
  }
}

impl flatbuffers::Verifiable for AvatarLevelTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<u32>("level", Self::VT_LEVEL, false)?
     .visit_field::<u32>("exp", Self::VT_EXP, false)?
     .finish();
    Ok(())
  }
}
pub struct AvatarLevelTemplateArgs {
    pub level: u32,
    pub exp: u32,
}
impl<'a> Default for AvatarLevelTemplateArgs {
  #[inline]
  fn default() -> Self {
    AvatarLevelTemplateArgs {
      level: 0,
      exp: 0,
    }
  }
}

pub struct AvatarLevelTemplateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AvatarLevelTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_level(&mut self, level: u32) {
    self.fbb_.push_slot::<u32>(AvatarLevelTemplate::VT_LEVEL, level, 0);
  }
  #[inline]
  pub fn add_exp(&mut self, exp: u32) {
    self.fbb_.push_slot::<u32>(AvatarLevelTemplate::VT_EXP, exp, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AvatarLevelTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    AvatarLevelTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<AvatarLevelTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for AvatarLevelTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("AvatarLevelTemplate");
      ds.field("level", &self.level());
      ds.field("exp", &self.exp());
      ds.finish()
  }
}
pub enum AvatarLevelTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct AvatarLevelTemplateTb<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for AvatarLevelTemplateTb<'a> {
  type Inner = AvatarLevelTemplateTb<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> AvatarLevelTemplateTb<'a> {
  pub const VT_DATA: flatbuffers::VOffsetT = 4;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    AvatarLevelTemplateTb { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args AvatarLevelTemplateTbArgs<'args>
  ) -> flatbuffers::WIPOffset<AvatarLevelTemplateTb<'bldr>> {
    let mut builder = AvatarLevelTemplateTbBuilder::new(_fbb);
    if let Some(x) = args.data { builder.add_data(x); }
    builder.finish()
  }


  #[inline]
  pub fn data(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<AvatarLevelTemplate<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<AvatarLevelTemplate>>>>(AvatarLevelTemplateTb::VT_DATA, None)}
  }
}

impl flatbuffers::Verifiable for AvatarLevelTemplateTb<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<AvatarLevelTemplate>>>>("data", Self::VT_DATA, false)?
     .finish();
    Ok(())
  }
}
pub struct AvatarLevelTemplateTbArgs<'a> {
    pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<AvatarLevelTemplate<'a>>>>>,
}
impl<'a> Default for AvatarLevelTemplateTbArgs<'a> {
  #[inline]
  fn default() -> Self {
    AvatarLevelTemplateTbArgs {
      data: None,
    }
  }
}

pub struct AvatarLevelTemplateTbBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AvatarLevelTemplateTbBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<AvatarLevelTemplate<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(AvatarLevelTemplateTb::VT_DATA, data);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AvatarLevelTemplateTbBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    AvatarLevelTemplateTbBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<AvatarLevelTemplateTb<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for AvatarLevelTemplateTb<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("AvatarLevelTemplateTb");
      ds.field("data", &self.data());
      ds.finish()
  }
}
