divvunspell 1.0.0-beta.3

Spell checking library for ZHFST/BHFST spellers, with case handling and tokenization support.
Documentation
// automatically generated by the FlatBuffers compiler, do not modify
#![allow(dead_code, unused_imports)]

use std::cmp::Ordering;
use std::mem;

extern crate flatbuffers;
use self::flatbuffers::EndianScalar;

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

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

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

impl<'a> IndexedWord<'a> {
    #[inline]
    pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
        IndexedWord { _tab: table }
    }
    #[allow(unused_mut)]
    pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
        _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
        args: &'args IndexedWordArgs<'args>,
    ) -> flatbuffers::WIPOffset<IndexedWord<'bldr>> {
        let mut builder = IndexedWordBuilder::new(_fbb);
        builder.add_index(args.index);
        if let Some(x) = args.value {
            builder.add_value(x);
        }
        builder.finish()
    }

    pub const VT_INDEX: flatbuffers::VOffsetT = 4;
    pub const VT_VALUE: flatbuffers::VOffsetT = 6;

    #[inline]
    pub fn index(&self) -> u64 {
        self._tab
            .get::<u64>(IndexedWord::VT_INDEX, Some(0))
            .unwrap()
    }
    #[inline]
    pub fn value(&self) -> Option<&'a str> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<&str>>(IndexedWord::VT_VALUE, None)
    }
}

pub struct IndexedWordArgs<'a> {
    pub index: u64,
    pub value: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for IndexedWordArgs<'a> {
    #[inline]
    fn default() -> Self {
        IndexedWordArgs {
            index: 0,
            value: None,
        }
    }
}
pub struct IndexedWordBuilder<'a: 'b, 'b> {
    fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> IndexedWordBuilder<'a, 'b> {
    #[inline]
    pub fn add_index(&mut self, index: u64) {
        self.fbb_.push_slot::<u64>(IndexedWord::VT_INDEX, index, 0);
    }
    #[inline]
    pub fn add_value(&mut self, value: flatbuffers::WIPOffset<&'b str>) {
        self.fbb_
            .push_slot_always::<flatbuffers::WIPOffset<_>>(IndexedWord::VT_VALUE, value);
    }
    #[inline]
    pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> IndexedWordBuilder<'a, 'b> {
        let start = _fbb.start_table();
        IndexedWordBuilder {
            fbb_: _fbb,
            start_: start,
        }
    }
    #[inline]
    pub fn finish(self) -> flatbuffers::WIPOffset<IndexedWord<'a>> {
        let o = self.fbb_.end_table(self.start_);
        flatbuffers::WIPOffset::new(o.value())
    }
}

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

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

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

impl<'a> WordContext<'a> {
    #[inline]
    pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
        WordContext { _tab: table }
    }
    #[allow(unused_mut)]
    pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
        _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
        args: &'args WordContextArgs<'args>,
    ) -> flatbuffers::WIPOffset<WordContext<'bldr>> {
        let mut builder = WordContextBuilder::new(_fbb);
        if let Some(x) = args.second_after {
            builder.add_second_after(x);
        }
        if let Some(x) = args.first_after {
            builder.add_first_after(x);
        }
        if let Some(x) = args.second_before {
            builder.add_second_before(x);
        }
        if let Some(x) = args.first_before {
            builder.add_first_before(x);
        }
        if let Some(x) = args.current {
            builder.add_current(x);
        }
        builder.finish()
    }

    pub const VT_CURRENT: flatbuffers::VOffsetT = 4;
    pub const VT_FIRST_BEFORE: flatbuffers::VOffsetT = 6;
    pub const VT_SECOND_BEFORE: flatbuffers::VOffsetT = 8;
    pub const VT_FIRST_AFTER: flatbuffers::VOffsetT = 10;
    pub const VT_SECOND_AFTER: flatbuffers::VOffsetT = 12;

    #[inline]
    pub fn current(&self) -> IndexedWord<'a> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<IndexedWord<'a>>>(WordContext::VT_CURRENT, None)
            .unwrap()
    }
    #[inline]
    pub fn first_before(&self) -> Option<IndexedWord<'a>> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<IndexedWord<'a>>>(
                WordContext::VT_FIRST_BEFORE,
                None,
            )
    }
    #[inline]
    pub fn second_before(&self) -> Option<IndexedWord<'a>> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<IndexedWord<'a>>>(
                WordContext::VT_SECOND_BEFORE,
                None,
            )
    }
    #[inline]
    pub fn first_after(&self) -> Option<IndexedWord<'a>> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<IndexedWord<'a>>>(WordContext::VT_FIRST_AFTER, None)
    }
    #[inline]
    pub fn second_after(&self) -> Option<IndexedWord<'a>> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<IndexedWord<'a>>>(
                WordContext::VT_SECOND_AFTER,
                None,
            )
    }
}

pub struct WordContextArgs<'a> {
    pub current: Option<flatbuffers::WIPOffset<IndexedWord<'a>>>,
    pub first_before: Option<flatbuffers::WIPOffset<IndexedWord<'a>>>,
    pub second_before: Option<flatbuffers::WIPOffset<IndexedWord<'a>>>,
    pub first_after: Option<flatbuffers::WIPOffset<IndexedWord<'a>>>,
    pub second_after: Option<flatbuffers::WIPOffset<IndexedWord<'a>>>,
}
impl<'a> Default for WordContextArgs<'a> {
    #[inline]
    fn default() -> Self {
        WordContextArgs {
            current: None, // required field
            first_before: None,
            second_before: None,
            first_after: None,
            second_after: None,
        }
    }
}
pub struct WordContextBuilder<'a: 'b, 'b> {
    fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> WordContextBuilder<'a, 'b> {
    #[inline]
    pub fn add_current(&mut self, current: flatbuffers::WIPOffset<IndexedWord<'b>>) {
        self.fbb_
            .push_slot_always::<flatbuffers::WIPOffset<IndexedWord>>(
                WordContext::VT_CURRENT,
                current,
            );
    }
    #[inline]
    pub fn add_first_before(&mut self, first_before: flatbuffers::WIPOffset<IndexedWord<'b>>) {
        self.fbb_
            .push_slot_always::<flatbuffers::WIPOffset<IndexedWord>>(
                WordContext::VT_FIRST_BEFORE,
                first_before,
            );
    }
    #[inline]
    pub fn add_second_before(&mut self, second_before: flatbuffers::WIPOffset<IndexedWord<'b>>) {
        self.fbb_
            .push_slot_always::<flatbuffers::WIPOffset<IndexedWord>>(
                WordContext::VT_SECOND_BEFORE,
                second_before,
            );
    }
    #[inline]
    pub fn add_first_after(&mut self, first_after: flatbuffers::WIPOffset<IndexedWord<'b>>) {
        self.fbb_
            .push_slot_always::<flatbuffers::WIPOffset<IndexedWord>>(
                WordContext::VT_FIRST_AFTER,
                first_after,
            );
    }
    #[inline]
    pub fn add_second_after(&mut self, second_after: flatbuffers::WIPOffset<IndexedWord<'b>>) {
        self.fbb_
            .push_slot_always::<flatbuffers::WIPOffset<IndexedWord>>(
                WordContext::VT_SECOND_AFTER,
                second_after,
            );
    }
    #[inline]
    pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> WordContextBuilder<'a, 'b> {
        let start = _fbb.start_table();
        WordContextBuilder {
            fbb_: _fbb,
            start_: start,
        }
    }
    #[inline]
    pub fn finish(self) -> flatbuffers::WIPOffset<WordContext<'a>> {
        let o = self.fbb_.end_table(self.start_);
        self.fbb_.required(o, WordContext::VT_CURRENT, "current");
        flatbuffers::WIPOffset::new(o.value())
    }
}

#[inline]
pub fn get_root_as_word_context<'a>(buf: &'a [u8]) -> WordContext<'a> {
    flatbuffers::get_root::<WordContext<'a>>(buf)
}

#[inline]
pub fn get_size_prefixed_root_as_word_context<'a>(buf: &'a [u8]) -> WordContext<'a> {
    flatbuffers::get_size_prefixed_root::<WordContext<'a>>(buf)
}

#[inline]
pub fn finish_word_context_buffer<'a, 'b>(
    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    root: flatbuffers::WIPOffset<WordContext<'a>>,
) {
    fbb.finish(root, None);
}

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