// 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 McuStatusOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> McuStatus<'a> {
  pub const VT_TEMP: flatbuffers::VOffsetT = 4;

  #[inline]
  pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    McuStatus { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    args: &'args McuStatusArgs
  ) -> flatbuffers::WIPOffset<McuStatus<'bldr>> {
    let mut builder = McuStatusBuilder::new(_fbb);
    builder.add_temp(args.temp);
    builder.finish()
  }


  #[inline]
  pub fn temp(&self) -> f32 {
    self._tab.get::<f32>(McuStatus::VT_TEMP, Some(0.0)).unwrap()
  }
}

impl flatbuffers::Verifiable for McuStatus<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<f32>("temp", Self::VT_TEMP, false)?
     .finish();
    Ok(())
  }
}
pub struct McuStatusArgs {
    pub temp: f32,
}
impl<'a> Default for McuStatusArgs {
  #[inline]
  fn default() -> Self {
    McuStatusArgs {
      temp: 0.0,
    }
  }
}

pub struct McuStatusBuilder<'a: 'b, 'b> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> McuStatusBuilder<'a, 'b> {
  #[inline]
  pub fn add_temp(&mut self, temp: f32) {
    self.fbb_.push_slot::<f32>(McuStatus::VT_TEMP, temp, 0.0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> McuStatusBuilder<'a, 'b> {
    let start = _fbb.start_table();
    McuStatusBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<McuStatus<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

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