// automatically generated by the FlatBuffers compiler, do not modify
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum OpenTypeGaspRangeRecordOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> OpenTypeGaspRangeRecord<'a> {
  pub const VT_RANGEMAXPPEM: flatbuffers::VOffsetT = 4;
  pub const VT_RANGEGASPBEHAVIOR: flatbuffers::VOffsetT = 6;

  #[inline]
  pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    OpenTypeGaspRangeRecord { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    args: &'args OpenTypeGaspRangeRecordArgs<'args>
  ) -> flatbuffers::WIPOffset<OpenTypeGaspRangeRecord<'bldr>> {
    let mut builder = OpenTypeGaspRangeRecordBuilder::new(_fbb);
    if let Some(x) = args.rangeGaspBehavior { builder.add_rangeGaspBehavior(x); }
    builder.add_rangeMaxPPEM(args.rangeMaxPPEM);
    builder.finish()
  }


  #[inline]
  pub fn rangeMaxPPEM(&self) -> u32 {
    self._tab.get::<u32>(OpenTypeGaspRangeRecord::VT_RANGEMAXPPEM, Some(0)).unwrap()
  }
  #[inline]
  pub fn rangeGaspBehavior(&self) -> Option<flatbuffers::Vector<'a, u32>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u32>>>(OpenTypeGaspRangeRecord::VT_RANGEGASPBEHAVIOR, None)
  }
}

impl flatbuffers::Verifiable for OpenTypeGaspRangeRecord<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<u32>("rangeMaxPPEM", Self::VT_RANGEMAXPPEM, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u32>>>("rangeGaspBehavior", Self::VT_RANGEGASPBEHAVIOR, false)?
     .finish();
    Ok(())
  }
}
pub struct OpenTypeGaspRangeRecordArgs<'a> {
    pub rangeMaxPPEM: u32,
    pub rangeGaspBehavior: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u32>>>,
}
impl<'a> Default for OpenTypeGaspRangeRecordArgs<'a> {
  #[inline]
  fn default() -> Self {
    OpenTypeGaspRangeRecordArgs {
      rangeMaxPPEM: 0,
      rangeGaspBehavior: None,
    }
  }
}
pub struct OpenTypeGaspRangeRecordBuilder<'a: 'b, 'b> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> OpenTypeGaspRangeRecordBuilder<'a, 'b> {
  #[inline]
  pub fn add_rangeMaxPPEM(&mut self, rangeMaxPPEM: u32) {
    self.fbb_.push_slot::<u32>(OpenTypeGaspRangeRecord::VT_RANGEMAXPPEM, rangeMaxPPEM, 0);
  }
  #[inline]
  pub fn add_rangeGaspBehavior(&mut self, rangeGaspBehavior: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u32>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(OpenTypeGaspRangeRecord::VT_RANGEGASPBEHAVIOR, rangeGaspBehavior);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> OpenTypeGaspRangeRecordBuilder<'a, 'b> {
    let start = _fbb.start_table();
    OpenTypeGaspRangeRecordBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<OpenTypeGaspRangeRecord<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

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