rustling 0.8.0

A blazingly fast library for computational linguistics
Documentation
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;


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

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


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

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

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

impl<'a> LsmModel<'a> {
  pub const VT_MAX_WORD_LENGTH: ::flatbuffers::VOffsetT = 4;
  pub const VT_WORDS: ::flatbuffers::VOffsetT = 6;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    LsmModel { _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 LsmModelArgs<'args>
  ) -> ::flatbuffers::WIPOffset<LsmModel<'bldr>> {
    let mut builder = LsmModelBuilder::new(_fbb);
    if let Some(x) = args.words { builder.add_words(x); }
    builder.add_max_word_length(args.max_word_length);
    builder.finish()
  }


  #[inline]
  pub fn max_word_length(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(LsmModel::VT_MAX_WORD_LENGTH, Some(0)).unwrap()}
  }
  #[inline]
  pub fn words(&self) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>> {
    // 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<&'a str>>>>(LsmModel::VT_WORDS, None).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for LsmModel<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<u32>("max_word_length", Self::VT_MAX_WORD_LENGTH, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<&'_ str>>>>("words", Self::VT_WORDS, true)?
     .finish();
    Ok(())
  }
}
pub struct LsmModelArgs<'a> {
    pub max_word_length: u32,
    pub words: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>,
}
impl<'a> Default for LsmModelArgs<'a> {
  #[inline]
  fn default() -> Self {
    LsmModelArgs {
      max_word_length: 0,
      words: None, // required field
    }
  }
}

pub struct LsmModelBuilder<'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> LsmModelBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_max_word_length(&mut self, max_word_length: u32) {
    self.fbb_.push_slot::<u32>(LsmModel::VT_MAX_WORD_LENGTH, max_word_length, 0);
  }
  #[inline]
  pub fn add_words(&mut self, words: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b  str>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(LsmModel::VT_WORDS, words);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> LsmModelBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    LsmModelBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<LsmModel<'a>> {
    let o = self.fbb_.end_table(self.start_);
    self.fbb_.required(o, LsmModel::VT_WORDS,"words");
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

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

#[inline]
pub fn finish_size_prefixed_lsm_model_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<LsmModel<'a>>) {
  fbb.finish_size_prefixed(root, None);
}
}  // pub mod lsm_fbs
}  // pub mod rustling