selium-remote-client-protocol 0.3.3

Selium module for supporting remote clients
Documentation
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
use super::*;
pub enum ScalarValueOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> ScalarValue<'a> {
  pub const VT_KIND: ::flatbuffers::VOffsetT = 4;
  pub const VT_BITS: ::flatbuffers::VOffsetT = 6;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    ScalarValue { _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 ScalarValueArgs
  ) -> ::flatbuffers::WIPOffset<ScalarValue<'bldr>> {
    let mut builder = ScalarValueBuilder::new(_fbb);
    builder.add_bits(args.bits);
    builder.add_kind(args.kind);
    builder.finish()
  }


  #[inline]
  pub fn kind(&self) -> AbiScalarType {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<AbiScalarType>(ScalarValue::VT_KIND, Some(AbiScalarType::I8)).unwrap()}
  }
  #[inline]
  pub fn bits(&self) -> u64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u64>(ScalarValue::VT_BITS, Some(0)).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for ScalarValue<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<AbiScalarType>("kind", Self::VT_KIND, false)?
     .visit_field::<u64>("bits", Self::VT_BITS, false)?
     .finish();
    Ok(())
  }
}
pub struct ScalarValueArgs {
    pub kind: AbiScalarType,
    pub bits: u64,
}
impl<'a> Default for ScalarValueArgs {
  #[inline]
  fn default() -> Self {
    ScalarValueArgs {
      kind: AbiScalarType::I8,
      bits: 0,
    }
  }
}

pub struct ScalarValueBuilder<'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> ScalarValueBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_kind(&mut self, kind: AbiScalarType) {
    self.fbb_.push_slot::<AbiScalarType>(ScalarValue::VT_KIND, kind, AbiScalarType::I8);
  }
  #[inline]
  pub fn add_bits(&mut self, bits: u64) {
    self.fbb_.push_slot::<u64>(ScalarValue::VT_BITS, bits, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ScalarValueBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    ScalarValueBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<ScalarValue<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

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