// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;


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

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

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

impl<'a> RecordV1<'a> {
  pub const VT_OBJECT_ID: ::flatbuffers::VOffsetT = 4;
  pub const VT_BUCKET_NAME: ::flatbuffers::VOffsetT = 6;
  pub const VT_OFFSET: ::flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    RecordV1 { _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 RecordV1Args<'args>
  ) -> ::flatbuffers::WIPOffset<RecordV1<'bldr>> {
    let mut builder = RecordV1Builder::new(_fbb);
    builder.add_offset(args.offset);
    builder.add_object_id(args.object_id);
    if let Some(x) = args.bucket_name { builder.add_bucket_name(x); }
    builder.finish()
  }


  #[inline]
  pub fn object_id(&self) -> u64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u64>(RecordV1::VT_OBJECT_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn bucket_name(&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>>(RecordV1::VT_BUCKET_NAME, None)}
  }
  #[inline]
  pub fn offset(&self) -> u64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u64>(RecordV1::VT_OFFSET, Some(0)).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for RecordV1<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<u64>("object_id", Self::VT_OBJECT_ID, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("bucket_name", Self::VT_BUCKET_NAME, false)?
     .visit_field::<u64>("offset", Self::VT_OFFSET, false)?
     .finish();
    Ok(())
  }
}
pub struct RecordV1Args<'a> {
    pub object_id: u64,
    pub bucket_name: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub offset: u64,
}
impl<'a> Default for RecordV1Args<'a> {
  #[inline]
  fn default() -> Self {
    RecordV1Args {
      object_id: 0,
      bucket_name: None,
      offset: 0,
    }
  }
}

pub struct RecordV1Builder<'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> RecordV1Builder<'a, 'b, A> {
  #[inline]
  pub fn add_object_id(&mut self, object_id: u64) {
    self.fbb_.push_slot::<u64>(RecordV1::VT_OBJECT_ID, object_id, 0);
  }
  #[inline]
  pub fn add_bucket_name(&mut self, bucket_name: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(RecordV1::VT_BUCKET_NAME, bucket_name);
  }
  #[inline]
  pub fn add_offset(&mut self, offset: u64) {
    self.fbb_.push_slot::<u64>(RecordV1::VT_OFFSET, offset, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> RecordV1Builder<'a, 'b, A> {
    let start = _fbb.start_table();
    RecordV1Builder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<RecordV1<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for RecordV1<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("RecordV1");
      ds.field("object_id", &self.object_id());
      ds.field("bucket_name", &self.bucket_name());
      ds.field("offset", &self.offset());
      ds.finish()
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `RecordV1`
/// 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_record_v1_unchecked`.
pub fn root_as_record_v1(buf: &[u8]) -> Result<RecordV1<'_>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::root::<RecordV1>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `RecordV1` 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_record_v1_unchecked`.
pub fn size_prefixed_root_as_record_v1(buf: &[u8]) -> Result<RecordV1<'_>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::size_prefixed_root::<RecordV1>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `RecordV1` 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_record_v1_unchecked`.
pub fn root_as_record_v1_with_opts<'b, 'o>(
  opts: &'o ::flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<RecordV1<'b>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::root_with_opts::<RecordV1<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `RecordV1` 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_record_v1_unchecked`.
pub fn size_prefixed_root_as_record_v1_with_opts<'b, 'o>(
  opts: &'o ::flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<RecordV1<'b>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::size_prefixed_root_with_opts::<RecordV1<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a RecordV1 and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `RecordV1`.
pub unsafe fn root_as_record_v1_unchecked(buf: &[u8]) -> RecordV1<'_> {
  unsafe { ::flatbuffers::root_unchecked::<RecordV1>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed RecordV1 and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `RecordV1`.
pub unsafe fn size_prefixed_root_as_record_v1_unchecked(buf: &[u8]) -> RecordV1<'_> {
  unsafe { ::flatbuffers::size_prefixed_root_unchecked::<RecordV1>(buf) }
}
#[inline]
pub fn finish_record_v1_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
    fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
    root: ::flatbuffers::WIPOffset<RecordV1<'a>>) {
  fbb.finish(root, None);
}

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