spacedatastandards-org 1.73.12

Space data standards framework based on CCSDS standards and Google FlatBuffers.
Documentation
// 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 DFHOffset {}
#[derive(Copy, Clone, PartialEq)]

/// GEO Drift History
pub struct DFH<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

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

impl<'a> DFH<'a> {
  pub const VT_ID: flatbuffers::VOffsetT = 4;
  pub const VT_EFFECTIVE_UNTIL: flatbuffers::VOffsetT = 6;
  pub const VT_DRIFT_RATE: flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    DFH { _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 DFHArgs<'args>
  ) -> flatbuffers::WIPOffset<DFH<'bldr>> {
    let mut builder = DFHBuilder::new(_fbb);
    builder.add_DRIFT_RATE(args.DRIFT_RATE);
    if let Some(x) = args.EFFECTIVE_UNTIL { builder.add_EFFECTIVE_UNTIL(x); }
    if let Some(x) = args.ID { builder.add_ID(x); }
    builder.finish()
  }

  pub fn unpack(&self) -> DFHT {
    let ID = self.ID().map(|x| {
      x.to_string()
    });
    let EFFECTIVE_UNTIL = self.EFFECTIVE_UNTIL().map(|x| {
      x.to_string()
    });
    let DRIFT_RATE = self.DRIFT_RATE();
    DFHT {
      ID,
      EFFECTIVE_UNTIL,
      DRIFT_RATE,
    }
  }

  #[inline]
  pub fn ID(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(DFH::VT_ID, None)}
  }
  #[inline]
  pub fn EFFECTIVE_UNTIL(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(DFH::VT_EFFECTIVE_UNTIL, None)}
  }
  #[inline]
  pub fn DRIFT_RATE(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(DFH::VT_DRIFT_RATE, Some(0.0)).unwrap()}
  }
}

impl flatbuffers::Verifiable for DFH<'_> {
  #[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<&str>>("ID", Self::VT_ID, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("EFFECTIVE_UNTIL", Self::VT_EFFECTIVE_UNTIL, false)?
     .visit_field::<f64>("DRIFT_RATE", Self::VT_DRIFT_RATE, false)?
     .finish();
    Ok(())
  }
}
pub struct DFHArgs<'a> {
    pub ID: Option<flatbuffers::WIPOffset<&'a str>>,
    pub EFFECTIVE_UNTIL: Option<flatbuffers::WIPOffset<&'a str>>,
    pub DRIFT_RATE: f64,
}
impl<'a> Default for DFHArgs<'a> {
  #[inline]
  fn default() -> Self {
    DFHArgs {
      ID: None,
      EFFECTIVE_UNTIL: None,
      DRIFT_RATE: 0.0,
    }
  }
}

pub struct DFHBuilder<'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> DFHBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_ID(&mut self, ID: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DFH::VT_ID, ID);
  }
  #[inline]
  pub fn add_EFFECTIVE_UNTIL(&mut self, EFFECTIVE_UNTIL: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DFH::VT_EFFECTIVE_UNTIL, EFFECTIVE_UNTIL);
  }
  #[inline]
  pub fn add_DRIFT_RATE(&mut self, DRIFT_RATE: f64) {
    self.fbb_.push_slot::<f64>(DFH::VT_DRIFT_RATE, DRIFT_RATE, 0.0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DFHBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    DFHBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<DFH<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for DFH<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("DFH");
      ds.field("ID", &self.ID());
      ds.field("EFFECTIVE_UNTIL", &self.EFFECTIVE_UNTIL());
      ds.field("DRIFT_RATE", &self.DRIFT_RATE());
      ds.finish()
  }
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct DFHT {
  pub ID: Option<String>,
  pub EFFECTIVE_UNTIL: Option<String>,
  pub DRIFT_RATE: f64,
}
impl Default for DFHT {
  fn default() -> Self {
    Self {
      ID: None,
      EFFECTIVE_UNTIL: None,
      DRIFT_RATE: 0.0,
    }
  }
}
impl DFHT {
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
    &self,
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
  ) -> flatbuffers::WIPOffset<DFH<'b>> {
    let ID = self.ID.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let EFFECTIVE_UNTIL = self.EFFECTIVE_UNTIL.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let DRIFT_RATE = self.DRIFT_RATE;
    DFH::create(_fbb, &DFHArgs{
      ID,
      EFFECTIVE_UNTIL,
      DRIFT_RATE,
    })
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `DFH`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_DFH_unchecked`.
pub fn root_as_DFH(buf: &[u8]) -> Result<DFH, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<DFH>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `DFH` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_DFH_unchecked`.
pub fn size_prefixed_root_as_DFH(buf: &[u8]) -> Result<DFH, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<DFH>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `DFH` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_DFH_unchecked`.
pub fn root_as_DFH_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<DFH<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<DFH<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `DFH` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_DFH_unchecked`.
pub fn size_prefixed_root_as_DFH_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<DFH<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<DFH<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a DFH and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `DFH`.
pub unsafe fn root_as_DFH_unchecked(buf: &[u8]) -> DFH {
  flatbuffers::root_unchecked::<DFH>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed DFH and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `DFH`.
pub unsafe fn size_prefixed_root_as_DFH_unchecked(buf: &[u8]) -> DFH {
  flatbuffers::size_prefixed_root_unchecked::<DFH>(buf)
}
pub const DFH_IDENTIFIER: &str = "$DFH";

#[inline]
pub fn DFH_buffer_has_identifier(buf: &[u8]) -> bool {
  flatbuffers::buffer_has_identifier(buf, DFH_IDENTIFIER, false)
}

#[inline]
pub fn DFH_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
  flatbuffers::buffer_has_identifier(buf, DFH_IDENTIFIER, true)
}

#[inline]
pub fn finish_DFH_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
    root: flatbuffers::WIPOffset<DFH<'a>>) {
  fbb.finish(root, Some(DFH_IDENTIFIER));
}

#[inline]
pub fn finish_size_prefixed_DFH_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<DFH<'a>>) {
  fbb.finish_size_prefixed(root, Some(DFH_IDENTIFIER));
}