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


#[allow(unused_imports, dead_code)]
pub mod dyf {

#[allow(unused_imports, dead_code)]
pub mod schema {

#[allow(unused_imports, dead_code)]
pub mod v_2 {


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

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

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

impl<'a> Node<'a> {
  pub const VT_CHILDREN: ::flatbuffers::VOffsetT = 4;
  pub const VT_HYPERPLANES: ::flatbuffers::VOffsetT = 6;
  pub const VT_NUM_BITS: ::flatbuffers::VOffsetT = 8;
  pub const VT_BUCKET_IDS_TO_CHILDREN: ::flatbuffers::VOffsetT = 10;
  pub const VT_CENTROID: ::flatbuffers::VOffsetT = 12;
  pub const VT_NUM_ITEMS: ::flatbuffers::VOffsetT = 14;
  pub const VT_BATCH_INDEX: ::flatbuffers::VOffsetT = 16;
  pub const VT_DEPTH: ::flatbuffers::VOffsetT = 18;
  pub const VT_EIGENVALUES: ::flatbuffers::VOffsetT = 20;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    Node { _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 NodeArgs<'args>
  ) -> ::flatbuffers::WIPOffset<Node<'bldr>> {
    let mut builder = NodeBuilder::new(_fbb);
    if let Some(x) = args.eigenvalues { builder.add_eigenvalues(x); }
    builder.add_batch_index(args.batch_index);
    builder.add_num_items(args.num_items);
    if let Some(x) = args.centroid { builder.add_centroid(x); }
    if let Some(x) = args.bucket_ids_to_children { builder.add_bucket_ids_to_children(x); }
    if let Some(x) = args.hyperplanes { builder.add_hyperplanes(x); }
    if let Some(x) = args.children { builder.add_children(x); }
    builder.add_depth(args.depth);
    builder.add_num_bits(args.num_bits);
    builder.finish()
  }


  #[inline]
  pub fn children(&self) -> Option<::flatbuffers::Vector<'a, u32>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u32>>>(Node::VT_CHILDREN, None)}
  }
  #[inline]
  pub fn hyperplanes(&self) -> Option<::flatbuffers::Vector<'a, f32>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(Node::VT_HYPERPLANES, None)}
  }
  #[inline]
  pub fn num_bits(&self) -> u8 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u8>(Node::VT_NUM_BITS, Some(0)).unwrap()}
  }
  #[inline]
  pub fn bucket_ids_to_children(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Node::VT_BUCKET_IDS_TO_CHILDREN, None)}
  }
  #[inline]
  pub fn centroid(&self) -> Option<::flatbuffers::Vector<'a, f32>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(Node::VT_CENTROID, None)}
  }
  #[inline]
  pub fn num_items(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(Node::VT_NUM_ITEMS, Some(0)).unwrap()}
  }
  #[inline]
  pub fn batch_index(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(Node::VT_BATCH_INDEX, Some(-1)).unwrap()}
  }
  #[inline]
  pub fn depth(&self) -> u8 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u8>(Node::VT_DEPTH, Some(0)).unwrap()}
  }
  #[inline]
  pub fn eigenvalues(&self) -> Option<::flatbuffers::Vector<'a, f32>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(Node::VT_EIGENVALUES, None)}
  }
}

impl ::flatbuffers::Verifiable for Node<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u32>>>("children", Self::VT_CHILDREN, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("hyperplanes", Self::VT_HYPERPLANES, false)?
     .visit_field::<u8>("num_bits", Self::VT_NUM_BITS, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u64>>>("bucket_ids_to_children", Self::VT_BUCKET_IDS_TO_CHILDREN, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("centroid", Self::VT_CENTROID, false)?
     .visit_field::<u32>("num_items", Self::VT_NUM_ITEMS, false)?
     .visit_field::<i32>("batch_index", Self::VT_BATCH_INDEX, false)?
     .visit_field::<u8>("depth", Self::VT_DEPTH, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("eigenvalues", Self::VT_EIGENVALUES, false)?
     .finish();
    Ok(())
  }
}
pub struct NodeArgs<'a> {
    pub children: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u32>>>,
    pub hyperplanes: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
    pub num_bits: u8,
    pub bucket_ids_to_children: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u64>>>,
    pub centroid: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
    pub num_items: u32,
    pub batch_index: i32,
    pub depth: u8,
    pub eigenvalues: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
}
impl<'a> Default for NodeArgs<'a> {
  #[inline]
  fn default() -> Self {
    NodeArgs {
      children: None,
      hyperplanes: None,
      num_bits: 0,
      bucket_ids_to_children: None,
      centroid: None,
      num_items: 0,
      batch_index: -1,
      depth: 0,
      eigenvalues: None,
    }
  }
}

pub struct NodeBuilder<'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> NodeBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_children(&mut self, children: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Node::VT_CHILDREN, children);
  }
  #[inline]
  pub fn add_hyperplanes(&mut self, hyperplanes: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Node::VT_HYPERPLANES, hyperplanes);
  }
  #[inline]
  pub fn add_num_bits(&mut self, num_bits: u8) {
    self.fbb_.push_slot::<u8>(Node::VT_NUM_BITS, num_bits, 0);
  }
  #[inline]
  pub fn add_bucket_ids_to_children(&mut self, bucket_ids_to_children: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Node::VT_BUCKET_IDS_TO_CHILDREN, bucket_ids_to_children);
  }
  #[inline]
  pub fn add_centroid(&mut self, centroid: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Node::VT_CENTROID, centroid);
  }
  #[inline]
  pub fn add_num_items(&mut self, num_items: u32) {
    self.fbb_.push_slot::<u32>(Node::VT_NUM_ITEMS, num_items, 0);
  }
  #[inline]
  pub fn add_batch_index(&mut self, batch_index: i32) {
    self.fbb_.push_slot::<i32>(Node::VT_BATCH_INDEX, batch_index, -1);
  }
  #[inline]
  pub fn add_depth(&mut self, depth: u8) {
    self.fbb_.push_slot::<u8>(Node::VT_DEPTH, depth, 0);
  }
  #[inline]
  pub fn add_eigenvalues(&mut self, eigenvalues: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Node::VT_EIGENVALUES, eigenvalues);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> NodeBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    NodeBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<Node<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for Node<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("Node");
      ds.field("children", &self.children());
      ds.field("hyperplanes", &self.hyperplanes());
      ds.field("num_bits", &self.num_bits());
      ds.field("bucket_ids_to_children", &self.bucket_ids_to_children());
      ds.field("centroid", &self.centroid());
      ds.field("num_items", &self.num_items());
      ds.field("batch_index", &self.batch_index());
      ds.field("depth", &self.depth());
      ds.field("eigenvalues", &self.eigenvalues());
      ds.finish()
  }
}
pub enum BatchDescriptorOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> BatchDescriptor<'a> {
  pub const VT_OFFSET: ::flatbuffers::VOffsetT = 4;
  pub const VT_LENGTH: ::flatbuffers::VOffsetT = 6;
  pub const VT_NUM_ROWS: ::flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    BatchDescriptor { _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 BatchDescriptorArgs
  ) -> ::flatbuffers::WIPOffset<BatchDescriptor<'bldr>> {
    let mut builder = BatchDescriptorBuilder::new(_fbb);
    builder.add_length(args.length);
    builder.add_offset(args.offset);
    builder.add_num_rows(args.num_rows);
    builder.finish()
  }


  #[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>(BatchDescriptor::VT_OFFSET, Some(0)).unwrap()}
  }
  #[inline]
  pub fn length(&self) -> u64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u64>(BatchDescriptor::VT_LENGTH, Some(0)).unwrap()}
  }
  #[inline]
  pub fn num_rows(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(BatchDescriptor::VT_NUM_ROWS, Some(0)).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for BatchDescriptor<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<u64>("offset", Self::VT_OFFSET, false)?
     .visit_field::<u64>("length", Self::VT_LENGTH, false)?
     .visit_field::<u32>("num_rows", Self::VT_NUM_ROWS, false)?
     .finish();
    Ok(())
  }
}
pub struct BatchDescriptorArgs {
    pub offset: u64,
    pub length: u64,
    pub num_rows: u32,
}
impl<'a> Default for BatchDescriptorArgs {
  #[inline]
  fn default() -> Self {
    BatchDescriptorArgs {
      offset: 0,
      length: 0,
      num_rows: 0,
    }
  }
}

pub struct BatchDescriptorBuilder<'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> BatchDescriptorBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_offset(&mut self, offset: u64) {
    self.fbb_.push_slot::<u64>(BatchDescriptor::VT_OFFSET, offset, 0);
  }
  #[inline]
  pub fn add_length(&mut self, length: u64) {
    self.fbb_.push_slot::<u64>(BatchDescriptor::VT_LENGTH, length, 0);
  }
  #[inline]
  pub fn add_num_rows(&mut self, num_rows: u32) {
    self.fbb_.push_slot::<u32>(BatchDescriptor::VT_NUM_ROWS, num_rows, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> BatchDescriptorBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    BatchDescriptorBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<BatchDescriptor<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for BatchDescriptor<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("BatchDescriptor");
      ds.field("offset", &self.offset());
      ds.field("length", &self.length());
      ds.field("num_rows", &self.num_rows());
      ds.finish()
  }
}
pub enum FieldDescriptorOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> FieldDescriptor<'a> {
  pub const VT_NAME: ::flatbuffers::VOffsetT = 4;
  pub const VT_ARROW_TYPE: ::flatbuffers::VOffsetT = 6;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    FieldDescriptor { _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 FieldDescriptorArgs<'args>
  ) -> ::flatbuffers::WIPOffset<FieldDescriptor<'bldr>> {
    let mut builder = FieldDescriptorBuilder::new(_fbb);
    if let Some(x) = args.arrow_type { builder.add_arrow_type(x); }
    if let Some(x) = args.name { builder.add_name(x); }
    builder.finish()
  }


  #[inline]
  pub fn 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>>(FieldDescriptor::VT_NAME, None)}
  }
  #[inline]
  pub fn arrow_type(&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>>(FieldDescriptor::VT_ARROW_TYPE, None)}
  }
}

impl ::flatbuffers::Verifiable for FieldDescriptor<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("arrow_type", Self::VT_ARROW_TYPE, false)?
     .finish();
    Ok(())
  }
}
pub struct FieldDescriptorArgs<'a> {
    pub name: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub arrow_type: Option<::flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for FieldDescriptorArgs<'a> {
  #[inline]
  fn default() -> Self {
    FieldDescriptorArgs {
      name: None,
      arrow_type: None,
    }
  }
}

pub struct FieldDescriptorBuilder<'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> FieldDescriptorBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(FieldDescriptor::VT_NAME, name);
  }
  #[inline]
  pub fn add_arrow_type(&mut self, arrow_type: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(FieldDescriptor::VT_ARROW_TYPE, arrow_type);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> FieldDescriptorBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    FieldDescriptorBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<FieldDescriptor<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for FieldDescriptor<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("FieldDescriptor");
      ds.field("name", &self.name());
      ds.field("arrow_type", &self.arrow_type());
      ds.finish()
  }
}
pub enum FieldLayerOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> FieldLayer<'a> {
  pub const VT_NAME: ::flatbuffers::VOffsetT = 4;
  pub const VT_FIELDS: ::flatbuffers::VOffsetT = 6;
  pub const VT_BATCHES: ::flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    FieldLayer { _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 FieldLayerArgs<'args>
  ) -> ::flatbuffers::WIPOffset<FieldLayer<'bldr>> {
    let mut builder = FieldLayerBuilder::new(_fbb);
    if let Some(x) = args.batches { builder.add_batches(x); }
    if let Some(x) = args.fields { builder.add_fields(x); }
    if let Some(x) = args.name { builder.add_name(x); }
    builder.finish()
  }


  #[inline]
  pub fn 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>>(FieldLayer::VT_NAME, None)}
  }
  #[inline]
  pub fn fields(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FieldDescriptor<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FieldDescriptor>>>>(FieldLayer::VT_FIELDS, None)}
  }
  #[inline]
  pub fn batches(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor>>>>(FieldLayer::VT_BATCHES, None)}
  }
}

impl ::flatbuffers::Verifiable for FieldLayer<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<FieldDescriptor>>>>("fields", Self::VT_FIELDS, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<BatchDescriptor>>>>("batches", Self::VT_BATCHES, false)?
     .finish();
    Ok(())
  }
}
pub struct FieldLayerArgs<'a> {
    pub name: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub fields: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FieldDescriptor<'a>>>>>,
    pub batches: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor<'a>>>>>,
}
impl<'a> Default for FieldLayerArgs<'a> {
  #[inline]
  fn default() -> Self {
    FieldLayerArgs {
      name: None,
      fields: None,
      batches: None,
    }
  }
}

pub struct FieldLayerBuilder<'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> FieldLayerBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(FieldLayer::VT_NAME, name);
  }
  #[inline]
  pub fn add_fields(&mut self, fields: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<FieldDescriptor<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(FieldLayer::VT_FIELDS, fields);
  }
  #[inline]
  pub fn add_batches(&mut self, batches: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<BatchDescriptor<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(FieldLayer::VT_BATCHES, batches);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> FieldLayerBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    FieldLayerBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<FieldLayer<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for FieldLayer<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("FieldLayer");
      ds.field("name", &self.name());
      ds.field("fields", &self.fields());
      ds.field("batches", &self.batches());
      ds.finish()
  }
}
pub enum BuildParamsOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> BuildParams<'a> {
  pub const VT_MAX_DEPTH: ::flatbuffers::VOffsetT = 4;
  pub const VT_NUM_BITS: ::flatbuffers::VOffsetT = 6;
  pub const VT_MIN_LEAF_SIZE: ::flatbuffers::VOffsetT = 8;
  pub const VT_SEED: ::flatbuffers::VOffsetT = 10;
  pub const VT_QUANTIZATION: ::flatbuffers::VOffsetT = 12;
  pub const VT_COMPRESSION: ::flatbuffers::VOffsetT = 14;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    BuildParams { _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 BuildParamsArgs<'args>
  ) -> ::flatbuffers::WIPOffset<BuildParams<'bldr>> {
    let mut builder = BuildParamsBuilder::new(_fbb);
    builder.add_seed(args.seed);
    if let Some(x) = args.compression { builder.add_compression(x); }
    if let Some(x) = args.quantization { builder.add_quantization(x); }
    builder.add_min_leaf_size(args.min_leaf_size);
    builder.add_num_bits(args.num_bits);
    builder.add_max_depth(args.max_depth);
    builder.finish()
  }


  #[inline]
  pub fn max_depth(&self) -> u8 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u8>(BuildParams::VT_MAX_DEPTH, Some(0)).unwrap()}
  }
  #[inline]
  pub fn num_bits(&self) -> u8 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u8>(BuildParams::VT_NUM_BITS, Some(0)).unwrap()}
  }
  #[inline]
  pub fn min_leaf_size(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(BuildParams::VT_MIN_LEAF_SIZE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn seed(&self) -> u64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u64>(BuildParams::VT_SEED, Some(0)).unwrap()}
  }
  #[inline]
  pub fn quantization(&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>>(BuildParams::VT_QUANTIZATION, None)}
  }
  #[inline]
  pub fn compression(&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>>(BuildParams::VT_COMPRESSION, None)}
  }
}

impl ::flatbuffers::Verifiable for BuildParams<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<u8>("max_depth", Self::VT_MAX_DEPTH, false)?
     .visit_field::<u8>("num_bits", Self::VT_NUM_BITS, false)?
     .visit_field::<u32>("min_leaf_size", Self::VT_MIN_LEAF_SIZE, false)?
     .visit_field::<u64>("seed", Self::VT_SEED, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("quantization", Self::VT_QUANTIZATION, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("compression", Self::VT_COMPRESSION, false)?
     .finish();
    Ok(())
  }
}
pub struct BuildParamsArgs<'a> {
    pub max_depth: u8,
    pub num_bits: u8,
    pub min_leaf_size: u32,
    pub seed: u64,
    pub quantization: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub compression: Option<::flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for BuildParamsArgs<'a> {
  #[inline]
  fn default() -> Self {
    BuildParamsArgs {
      max_depth: 0,
      num_bits: 0,
      min_leaf_size: 0,
      seed: 0,
      quantization: None,
      compression: None,
    }
  }
}

pub struct BuildParamsBuilder<'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> BuildParamsBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_max_depth(&mut self, max_depth: u8) {
    self.fbb_.push_slot::<u8>(BuildParams::VT_MAX_DEPTH, max_depth, 0);
  }
  #[inline]
  pub fn add_num_bits(&mut self, num_bits: u8) {
    self.fbb_.push_slot::<u8>(BuildParams::VT_NUM_BITS, num_bits, 0);
  }
  #[inline]
  pub fn add_min_leaf_size(&mut self, min_leaf_size: u32) {
    self.fbb_.push_slot::<u32>(BuildParams::VT_MIN_LEAF_SIZE, min_leaf_size, 0);
  }
  #[inline]
  pub fn add_seed(&mut self, seed: u64) {
    self.fbb_.push_slot::<u64>(BuildParams::VT_SEED, seed, 0);
  }
  #[inline]
  pub fn add_quantization(&mut self, quantization: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(BuildParams::VT_QUANTIZATION, quantization);
  }
  #[inline]
  pub fn add_compression(&mut self, compression: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(BuildParams::VT_COMPRESSION, compression);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> BuildParamsBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    BuildParamsBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<BuildParams<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for BuildParams<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("BuildParams");
      ds.field("max_depth", &self.max_depth());
      ds.field("num_bits", &self.num_bits());
      ds.field("min_leaf_size", &self.min_leaf_size());
      ds.field("seed", &self.seed());
      ds.field("quantization", &self.quantization());
      ds.field("compression", &self.compression());
      ds.finish()
  }
}
pub enum KeyValueOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> KeyValue<'a> {
  pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
  pub const VT_VALUE: ::flatbuffers::VOffsetT = 6;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    KeyValue { _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 KeyValueArgs<'args>
  ) -> ::flatbuffers::WIPOffset<KeyValue<'bldr>> {
    let mut builder = KeyValueBuilder::new(_fbb);
    if let Some(x) = args.value { builder.add_value(x); }
    if let Some(x) = args.key { builder.add_key(x); }
    builder.finish()
  }


  #[inline]
  pub fn key(&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>>(KeyValue::VT_KEY, None)}
  }
  #[inline]
  pub fn value(&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>>(KeyValue::VT_VALUE, None)}
  }
}

impl ::flatbuffers::Verifiable for KeyValue<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("key", Self::VT_KEY, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("value", Self::VT_VALUE, false)?
     .finish();
    Ok(())
  }
}
pub struct KeyValueArgs<'a> {
    pub key: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub value: Option<::flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for KeyValueArgs<'a> {
  #[inline]
  fn default() -> Self {
    KeyValueArgs {
      key: None,
      value: None,
    }
  }
}

pub struct KeyValueBuilder<'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> KeyValueBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(KeyValue::VT_KEY, key);
  }
  #[inline]
  pub fn add_value(&mut self, value: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(KeyValue::VT_VALUE, value);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> KeyValueBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    KeyValueBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<KeyValue<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for KeyValue<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("KeyValue");
      ds.field("key", &self.key());
      ds.field("value", &self.value());
      ds.finish()
  }
}
pub enum IndexOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> Index<'a> {
  pub const VT_VERSION: ::flatbuffers::VOffsetT = 4;
  pub const VT_EMBEDDING_DIM: ::flatbuffers::VOffsetT = 6;
  pub const VT_TOTAL_ITEMS: ::flatbuffers::VOffsetT = 8;
  pub const VT_NUM_LEAVES: ::flatbuffers::VOffsetT = 10;
  pub const VT_ROOT: ::flatbuffers::VOffsetT = 12;
  pub const VT_NODES: ::flatbuffers::VOffsetT = 14;
  pub const VT_BATCHES: ::flatbuffers::VOffsetT = 16;
  pub const VT_BUILD_PARAMS: ::flatbuffers::VOffsetT = 18;
  pub const VT_METADATA: ::flatbuffers::VOffsetT = 20;
  pub const VT_OVERFLOW_BATCHES: ::flatbuffers::VOffsetT = 22;
  pub const VT_FIELD_LAYERS: ::flatbuffers::VOffsetT = 24;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    Index { _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 IndexArgs<'args>
  ) -> ::flatbuffers::WIPOffset<Index<'bldr>> {
    let mut builder = IndexBuilder::new(_fbb);
    builder.add_total_items(args.total_items);
    if let Some(x) = args.field_layers { builder.add_field_layers(x); }
    if let Some(x) = args.overflow_batches { builder.add_overflow_batches(x); }
    if let Some(x) = args.metadata { builder.add_metadata(x); }
    if let Some(x) = args.build_params { builder.add_build_params(x); }
    if let Some(x) = args.batches { builder.add_batches(x); }
    if let Some(x) = args.nodes { builder.add_nodes(x); }
    builder.add_root(args.root);
    builder.add_num_leaves(args.num_leaves);
    if let Some(x) = args.version { builder.add_version(x); }
    builder.add_embedding_dim(args.embedding_dim);
    builder.finish()
  }


  #[inline]
  pub fn version(&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>>(Index::VT_VERSION, None)}
  }
  #[inline]
  pub fn embedding_dim(&self) -> u16 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u16>(Index::VT_EMBEDDING_DIM, Some(0)).unwrap()}
  }
  #[inline]
  pub fn total_items(&self) -> u64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u64>(Index::VT_TOTAL_ITEMS, Some(0)).unwrap()}
  }
  #[inline]
  pub fn num_leaves(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(Index::VT_NUM_LEAVES, Some(0)).unwrap()}
  }
  #[inline]
  pub fn root(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(Index::VT_ROOT, Some(0)).unwrap()}
  }
  #[inline]
  pub fn nodes(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Node<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Node>>>>(Index::VT_NODES, None)}
  }
  #[inline]
  pub fn batches(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor>>>>(Index::VT_BATCHES, None)}
  }
  #[inline]
  pub fn build_params(&self) -> Option<BuildParams<'a>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<BuildParams>>(Index::VT_BUILD_PARAMS, None)}
  }
  #[inline]
  pub fn metadata(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<KeyValue>>>>(Index::VT_METADATA, None)}
  }
  #[inline]
  pub fn overflow_batches(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor>>>>(Index::VT_OVERFLOW_BATCHES, None)}
  }
  #[inline]
  pub fn field_layers(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FieldLayer<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FieldLayer>>>>(Index::VT_FIELD_LAYERS, None)}
  }
}

impl ::flatbuffers::Verifiable for Index<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("version", Self::VT_VERSION, false)?
     .visit_field::<u16>("embedding_dim", Self::VT_EMBEDDING_DIM, false)?
     .visit_field::<u64>("total_items", Self::VT_TOTAL_ITEMS, false)?
     .visit_field::<u32>("num_leaves", Self::VT_NUM_LEAVES, false)?
     .visit_field::<u32>("root", Self::VT_ROOT, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<Node>>>>("nodes", Self::VT_NODES, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<BatchDescriptor>>>>("batches", Self::VT_BATCHES, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<BuildParams>>("build_params", Self::VT_BUILD_PARAMS, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<KeyValue>>>>("metadata", Self::VT_METADATA, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<BatchDescriptor>>>>("overflow_batches", Self::VT_OVERFLOW_BATCHES, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<FieldLayer>>>>("field_layers", Self::VT_FIELD_LAYERS, false)?
     .finish();
    Ok(())
  }
}
pub struct IndexArgs<'a> {
    pub version: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub embedding_dim: u16,
    pub total_items: u64,
    pub num_leaves: u32,
    pub root: u32,
    pub nodes: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Node<'a>>>>>,
    pub batches: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor<'a>>>>>,
    pub build_params: Option<::flatbuffers::WIPOffset<BuildParams<'a>>>,
    pub metadata: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<KeyValue<'a>>>>>,
    pub overflow_batches: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<BatchDescriptor<'a>>>>>,
    pub field_layers: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FieldLayer<'a>>>>>,
}
impl<'a> Default for IndexArgs<'a> {
  #[inline]
  fn default() -> Self {
    IndexArgs {
      version: None,
      embedding_dim: 0,
      total_items: 0,
      num_leaves: 0,
      root: 0,
      nodes: None,
      batches: None,
      build_params: None,
      metadata: None,
      overflow_batches: None,
      field_layers: None,
    }
  }
}

pub struct IndexBuilder<'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> IndexBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_version(&mut self, version: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Index::VT_VERSION, version);
  }
  #[inline]
  pub fn add_embedding_dim(&mut self, embedding_dim: u16) {
    self.fbb_.push_slot::<u16>(Index::VT_EMBEDDING_DIM, embedding_dim, 0);
  }
  #[inline]
  pub fn add_total_items(&mut self, total_items: u64) {
    self.fbb_.push_slot::<u64>(Index::VT_TOTAL_ITEMS, total_items, 0);
  }
  #[inline]
  pub fn add_num_leaves(&mut self, num_leaves: u32) {
    self.fbb_.push_slot::<u32>(Index::VT_NUM_LEAVES, num_leaves, 0);
  }
  #[inline]
  pub fn add_root(&mut self, root: u32) {
    self.fbb_.push_slot::<u32>(Index::VT_ROOT, root, 0);
  }
  #[inline]
  pub fn add_nodes(&mut self, nodes: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Node<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Index::VT_NODES, nodes);
  }
  #[inline]
  pub fn add_batches(&mut self, batches: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<BatchDescriptor<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Index::VT_BATCHES, batches);
  }
  #[inline]
  pub fn add_build_params(&mut self, build_params: ::flatbuffers::WIPOffset<BuildParams<'b >>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<BuildParams>>(Index::VT_BUILD_PARAMS, build_params);
  }
  #[inline]
  pub fn add_metadata(&mut self, metadata: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<KeyValue<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Index::VT_METADATA, metadata);
  }
  #[inline]
  pub fn add_overflow_batches(&mut self, overflow_batches: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<BatchDescriptor<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Index::VT_OVERFLOW_BATCHES, overflow_batches);
  }
  #[inline]
  pub fn add_field_layers(&mut self, field_layers: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<FieldLayer<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Index::VT_FIELD_LAYERS, field_layers);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> IndexBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    IndexBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<Index<'a>> {
    let o = self.fbb_.end_table(self.start_);
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for Index<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("Index");
      ds.field("version", &self.version());
      ds.field("embedding_dim", &self.embedding_dim());
      ds.field("total_items", &self.total_items());
      ds.field("num_leaves", &self.num_leaves());
      ds.field("root", &self.root());
      ds.field("nodes", &self.nodes());
      ds.field("batches", &self.batches());
      ds.field("build_params", &self.build_params());
      ds.field("metadata", &self.metadata());
      ds.field("overflow_batches", &self.overflow_batches());
      ds.field("field_layers", &self.field_layers());
      ds.finish()
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `Index`
/// 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_index_unchecked`.
pub fn root_as_index(buf: &[u8]) -> Result<Index<'_>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::root::<Index>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `Index` 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_index_unchecked`.
pub fn size_prefixed_root_as_index(buf: &[u8]) -> Result<Index<'_>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::size_prefixed_root::<Index>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `Index` 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_index_unchecked`.
pub fn root_as_index_with_opts<'b, 'o>(
  opts: &'o ::flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<Index<'b>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::root_with_opts::<Index<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Index` 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_index_unchecked`.
pub fn size_prefixed_root_as_index_with_opts<'b, 'o>(
  opts: &'o ::flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<Index<'b>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::size_prefixed_root_with_opts::<Index<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Index and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Index`.
pub unsafe fn root_as_index_unchecked(buf: &[u8]) -> Index<'_> {
  unsafe { ::flatbuffers::root_unchecked::<Index>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Index and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Index`.
pub unsafe fn size_prefixed_root_as_index_unchecked(buf: &[u8]) -> Index<'_> {
  unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Index>(buf) }
}
#[inline]
pub fn finish_index_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
    fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
    root: ::flatbuffers::WIPOffset<Index<'a>>) {
  fbb.finish(root, None);
}

#[inline]
pub fn finish_size_prefixed_index_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<Index<'a>>) {
  fbb.finish_size_prefixed(root, None);
}
}  // pub mod v2
}  // pub mod schema
}  // pub mod dyf

