use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_PTYPE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_PTYPE: u8 = 10;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_PTYPE: [PType; 11] = [
PType::U8,
PType::U16,
PType::U32,
PType::U64,
PType::I8,
PType::I16,
PType::I32,
PType::I64,
PType::F16,
PType::F32,
PType::F64,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct PType(pub u8);
#[allow(non_upper_case_globals)]
impl PType {
pub const U8: Self = Self(0);
pub const U16: Self = Self(1);
pub const U32: Self = Self(2);
pub const U64: Self = Self(3);
pub const I8: Self = Self(4);
pub const I16: Self = Self(5);
pub const I32: Self = Self(6);
pub const I64: Self = Self(7);
pub const F16: Self = Self(8);
pub const F32: Self = Self(9);
pub const F64: Self = Self(10);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 10;
pub const ENUM_VALUES: &'static [Self] = &[
Self::U8,
Self::U16,
Self::U32,
Self::U64,
Self::I8,
Self::I16,
Self::I32,
Self::I64,
Self::F16,
Self::F32,
Self::F64,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::U8 => Some("U8"),
Self::U16 => Some("U16"),
Self::U32 => Some("U32"),
Self::U64 => Some("U64"),
Self::I8 => Some("I8"),
Self::I16 => Some("I16"),
Self::I32 => Some("I32"),
Self::I64 => Some("I64"),
Self::F16 => Some("F16"),
Self::F32 => Some("F32"),
Self::F64 => Some("F64"),
_ => None,
}
}
}
impl core::fmt::Debug for PType {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for PType {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b)
}
}
impl flatbuffers::Push for PType {
type Output = PType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
}
}
impl flatbuffers::EndianScalar for PType {
type Scalar = u8;
#[inline]
fn to_little_endian(self) -> u8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self {
let b = u8::from_le(v);
Self(b)
}
}
impl<'a> flatbuffers::Verifiable for PType {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for PType {}
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_TYPE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_TYPE: u8 = 11;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_TYPE: [Type; 12] = [
Type::NONE,
Type::Null,
Type::Bool,
Type::Primitive,
Type::Decimal,
Type::Utf8,
Type::Binary,
Type::Struct_,
Type::List,
Type::Extension,
Type::FixedSizeList,
Type::Variant,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct Type(pub u8);
#[allow(non_upper_case_globals)]
impl Type {
pub const NONE: Self = Self(0);
pub const Null: Self = Self(1);
pub const Bool: Self = Self(2);
pub const Primitive: Self = Self(3);
pub const Decimal: Self = Self(4);
pub const Utf8: Self = Self(5);
pub const Binary: Self = Self(6);
pub const Struct_: Self = Self(7);
pub const List: Self = Self(8);
pub const Extension: Self = Self(9);
pub const FixedSizeList: Self = Self(10);
pub const Variant: Self = Self(11);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 11;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::Null,
Self::Bool,
Self::Primitive,
Self::Decimal,
Self::Utf8,
Self::Binary,
Self::Struct_,
Self::List,
Self::Extension,
Self::FixedSizeList,
Self::Variant,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::Null => Some("Null"),
Self::Bool => Some("Bool"),
Self::Primitive => Some("Primitive"),
Self::Decimal => Some("Decimal"),
Self::Utf8 => Some("Utf8"),
Self::Binary => Some("Binary"),
Self::Struct_ => Some("Struct_"),
Self::List => Some("List"),
Self::Extension => Some("Extension"),
Self::FixedSizeList => Some("FixedSizeList"),
Self::Variant => Some("Variant"),
_ => None,
}
}
}
impl core::fmt::Debug for Type {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for Type {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b)
}
}
impl flatbuffers::Push for Type {
type Output = Type;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
}
}
impl flatbuffers::EndianScalar for Type {
type Scalar = u8;
#[inline]
fn to_little_endian(self) -> u8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self {
let b = u8::from_le(v);
Self(b)
}
}
impl<'a> flatbuffers::Verifiable for Type {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for Type {}
pub struct TypeUnionTableOffset {}
pub enum NullOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Null<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Null<'a> {
type Inner = Null<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Null<'a> {
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Null { _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 NullArgs
) -> flatbuffers::WIPOffset<Null<'bldr>> {
let mut builder = NullBuilder::new(_fbb);
builder.finish()
}
}
impl flatbuffers::Verifiable for Null<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.finish();
Ok(())
}
}
pub struct NullArgs {
}
impl<'a> Default for NullArgs {
#[inline]
fn default() -> Self {
NullArgs {
}
}
}
pub struct NullBuilder<'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> NullBuilder<'a, 'b, A> {
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> NullBuilder<'a, 'b, A> {
let start = _fbb.start_table();
NullBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Null<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Null<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Null");
ds.finish()
}
}
pub enum BoolOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Bool<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Bool<'a> {
type Inner = Bool<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Bool<'a> {
pub const VT_NULLABLE: flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Bool { _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 BoolArgs
) -> flatbuffers::WIPOffset<Bool<'bldr>> {
let mut builder = BoolBuilder::new(_fbb);
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Bool::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Bool<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct BoolArgs {
pub nullable: bool,
}
impl<'a> Default for BoolArgs {
#[inline]
fn default() -> Self {
BoolArgs {
nullable: false,
}
}
}
pub struct BoolBuilder<'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> BoolBuilder<'a, 'b, A> {
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Bool::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BoolBuilder<'a, 'b, A> {
let start = _fbb.start_table();
BoolBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Bool<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Bool<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Bool");
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum PrimitiveOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Primitive<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Primitive<'a> {
type Inner = Primitive<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Primitive<'a> {
pub const VT_PTYPE: flatbuffers::VOffsetT = 4;
pub const VT_NULLABLE: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Primitive { _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 PrimitiveArgs
) -> flatbuffers::WIPOffset<Primitive<'bldr>> {
let mut builder = PrimitiveBuilder::new(_fbb);
builder.add_nullable(args.nullable);
builder.add_ptype(args.ptype);
builder.finish()
}
#[inline]
pub fn ptype(&self) -> PType {
unsafe { self._tab.get::<PType>(Primitive::VT_PTYPE, Some(PType::U8)).unwrap()}
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Primitive::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Primitive<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<PType>("ptype", Self::VT_PTYPE, false)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct PrimitiveArgs {
pub ptype: PType,
pub nullable: bool,
}
impl<'a> Default for PrimitiveArgs {
#[inline]
fn default() -> Self {
PrimitiveArgs {
ptype: PType::U8,
nullable: false,
}
}
}
pub struct PrimitiveBuilder<'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> PrimitiveBuilder<'a, 'b, A> {
#[inline]
pub fn add_ptype(&mut self, ptype: PType) {
self.fbb_.push_slot::<PType>(Primitive::VT_PTYPE, ptype, PType::U8);
}
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Primitive::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PrimitiveBuilder<'a, 'b, A> {
let start = _fbb.start_table();
PrimitiveBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Primitive<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Primitive<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Primitive");
ds.field("ptype", &self.ptype());
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum DecimalOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Decimal<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Decimal<'a> {
type Inner = Decimal<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Decimal<'a> {
pub const VT_PRECISION: flatbuffers::VOffsetT = 4;
pub const VT_SCALE: flatbuffers::VOffsetT = 6;
pub const VT_NULLABLE: flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Decimal { _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 DecimalArgs
) -> flatbuffers::WIPOffset<Decimal<'bldr>> {
let mut builder = DecimalBuilder::new(_fbb);
builder.add_nullable(args.nullable);
builder.add_scale(args.scale);
builder.add_precision(args.precision);
builder.finish()
}
#[inline]
pub fn precision(&self) -> u8 {
unsafe { self._tab.get::<u8>(Decimal::VT_PRECISION, Some(0)).unwrap()}
}
#[inline]
pub fn scale(&self) -> i8 {
unsafe { self._tab.get::<i8>(Decimal::VT_SCALE, Some(0)).unwrap()}
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Decimal::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Decimal<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<u8>("precision", Self::VT_PRECISION, false)?
.visit_field::<i8>("scale", Self::VT_SCALE, false)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct DecimalArgs {
pub precision: u8,
pub scale: i8,
pub nullable: bool,
}
impl<'a> Default for DecimalArgs {
#[inline]
fn default() -> Self {
DecimalArgs {
precision: 0,
scale: 0,
nullable: false,
}
}
}
pub struct DecimalBuilder<'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> DecimalBuilder<'a, 'b, A> {
#[inline]
pub fn add_precision(&mut self, precision: u8) {
self.fbb_.push_slot::<u8>(Decimal::VT_PRECISION, precision, 0);
}
#[inline]
pub fn add_scale(&mut self, scale: i8) {
self.fbb_.push_slot::<i8>(Decimal::VT_SCALE, scale, 0);
}
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Decimal::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DecimalBuilder<'a, 'b, A> {
let start = _fbb.start_table();
DecimalBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Decimal<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Decimal<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Decimal");
ds.field("precision", &self.precision());
ds.field("scale", &self.scale());
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum Utf8Offset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Utf8<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Utf8<'a> {
type Inner = Utf8<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Utf8<'a> {
pub const VT_NULLABLE: flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Utf8 { _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 Utf8Args
) -> flatbuffers::WIPOffset<Utf8<'bldr>> {
let mut builder = Utf8Builder::new(_fbb);
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Utf8::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Utf8<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct Utf8Args {
pub nullable: bool,
}
impl<'a> Default for Utf8Args {
#[inline]
fn default() -> Self {
Utf8Args {
nullable: false,
}
}
}
pub struct Utf8Builder<'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> Utf8Builder<'a, 'b, A> {
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Utf8::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Utf8Builder<'a, 'b, A> {
let start = _fbb.start_table();
Utf8Builder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Utf8<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Utf8<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Utf8");
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum BinaryOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Binary<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Binary<'a> {
type Inner = Binary<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Binary<'a> {
pub const VT_NULLABLE: flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Binary { _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 BinaryArgs
) -> flatbuffers::WIPOffset<Binary<'bldr>> {
let mut builder = BinaryBuilder::new(_fbb);
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Binary::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Binary<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct BinaryArgs {
pub nullable: bool,
}
impl<'a> Default for BinaryArgs {
#[inline]
fn default() -> Self {
BinaryArgs {
nullable: false,
}
}
}
pub struct BinaryBuilder<'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> BinaryBuilder<'a, 'b, A> {
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Binary::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BinaryBuilder<'a, 'b, A> {
let start = _fbb.start_table();
BinaryBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Binary<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Binary<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Binary");
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum Struct_Offset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Struct_<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Struct_<'a> {
type Inner = Struct_<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Struct_<'a> {
pub const VT_NAMES: flatbuffers::VOffsetT = 4;
pub const VT_DTYPES: flatbuffers::VOffsetT = 6;
pub const VT_NULLABLE: flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Struct_ { _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 Struct_Args<'args>
) -> flatbuffers::WIPOffset<Struct_<'bldr>> {
let mut builder = Struct_Builder::new(_fbb);
if let Some(x) = args.dtypes { builder.add_dtypes(x); }
if let Some(x) = args.names { builder.add_names(x); }
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn names(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>(Struct_::VT_NAMES, None)}
}
#[inline]
pub fn dtypes(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<DType<'a>>>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<DType>>>>(Struct_::VT_DTYPES, None)}
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Struct_::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Struct_<'_> {
#[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<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>>>("names", Self::VT_NAMES, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<DType>>>>("dtypes", Self::VT_DTYPES, false)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct Struct_Args<'a> {
pub names: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
pub dtypes: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<DType<'a>>>>>,
pub nullable: bool,
}
impl<'a> Default for Struct_Args<'a> {
#[inline]
fn default() -> Self {
Struct_Args {
names: None,
dtypes: None,
nullable: false,
}
}
}
pub struct Struct_Builder<'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> Struct_Builder<'a, 'b, A> {
#[inline]
pub fn add_names(&mut self, names: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b str>>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Struct_::VT_NAMES, names);
}
#[inline]
pub fn add_dtypes(&mut self, dtypes: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<DType<'b >>>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Struct_::VT_DTYPES, dtypes);
}
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Struct_::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Struct_Builder<'a, 'b, A> {
let start = _fbb.start_table();
Struct_Builder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Struct_<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Struct_<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Struct_");
ds.field("names", &self.names());
ds.field("dtypes", &self.dtypes());
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum ListOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct List<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for List<'a> {
type Inner = List<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> List<'a> {
pub const VT_ELEMENT_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_NULLABLE: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
List { _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 ListArgs<'args>
) -> flatbuffers::WIPOffset<List<'bldr>> {
let mut builder = ListBuilder::new(_fbb);
if let Some(x) = args.element_type { builder.add_element_type(x); }
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn element_type(&self) -> Option<DType<'a>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<DType>>(List::VT_ELEMENT_TYPE, None)}
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(List::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for List<'_> {
#[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<DType>>("element_type", Self::VT_ELEMENT_TYPE, false)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct ListArgs<'a> {
pub element_type: Option<flatbuffers::WIPOffset<DType<'a>>>,
pub nullable: bool,
}
impl<'a> Default for ListArgs<'a> {
#[inline]
fn default() -> Self {
ListArgs {
element_type: None,
nullable: false,
}
}
}
pub struct ListBuilder<'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> ListBuilder<'a, 'b, A> {
#[inline]
pub fn add_element_type(&mut self, element_type: flatbuffers::WIPOffset<DType<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<DType>>(List::VT_ELEMENT_TYPE, element_type);
}
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(List::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ListBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ListBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<List<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for List<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("List");
ds.field("element_type", &self.element_type());
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum FixedSizeListOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct FixedSizeList<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for FixedSizeList<'a> {
type Inner = FixedSizeList<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> FixedSizeList<'a> {
pub const VT_ELEMENT_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_SIZE: flatbuffers::VOffsetT = 6;
pub const VT_NULLABLE: flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
FixedSizeList { _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 FixedSizeListArgs<'args>
) -> flatbuffers::WIPOffset<FixedSizeList<'bldr>> {
let mut builder = FixedSizeListBuilder::new(_fbb);
builder.add_size(args.size);
if let Some(x) = args.element_type { builder.add_element_type(x); }
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn element_type(&self) -> Option<DType<'a>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<DType>>(FixedSizeList::VT_ELEMENT_TYPE, None)}
}
#[inline]
pub fn size(&self) -> u32 {
unsafe { self._tab.get::<u32>(FixedSizeList::VT_SIZE, Some(0)).unwrap()}
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(FixedSizeList::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for FixedSizeList<'_> {
#[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<DType>>("element_type", Self::VT_ELEMENT_TYPE, false)?
.visit_field::<u32>("size", Self::VT_SIZE, false)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct FixedSizeListArgs<'a> {
pub element_type: Option<flatbuffers::WIPOffset<DType<'a>>>,
pub size: u32,
pub nullable: bool,
}
impl<'a> Default for FixedSizeListArgs<'a> {
#[inline]
fn default() -> Self {
FixedSizeListArgs {
element_type: None,
size: 0,
nullable: false,
}
}
}
pub struct FixedSizeListBuilder<'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> FixedSizeListBuilder<'a, 'b, A> {
#[inline]
pub fn add_element_type(&mut self, element_type: flatbuffers::WIPOffset<DType<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<DType>>(FixedSizeList::VT_ELEMENT_TYPE, element_type);
}
#[inline]
pub fn add_size(&mut self, size: u32) {
self.fbb_.push_slot::<u32>(FixedSizeList::VT_SIZE, size, 0);
}
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(FixedSizeList::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FixedSizeListBuilder<'a, 'b, A> {
let start = _fbb.start_table();
FixedSizeListBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<FixedSizeList<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for FixedSizeList<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("FixedSizeList");
ds.field("element_type", &self.element_type());
ds.field("size", &self.size());
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum ExtensionOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Extension<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Extension<'a> {
type Inner = Extension<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Extension<'a> {
pub const VT_ID: flatbuffers::VOffsetT = 4;
pub const VT_STORAGE_DTYPE: flatbuffers::VOffsetT = 6;
pub const VT_METADATA: flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Extension { _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 ExtensionArgs<'args>
) -> flatbuffers::WIPOffset<Extension<'bldr>> {
let mut builder = ExtensionBuilder::new(_fbb);
if let Some(x) = args.metadata { builder.add_metadata(x); }
if let Some(x) = args.storage_dtype { builder.add_storage_dtype(x); }
if let Some(x) = args.id { builder.add_id(x); }
builder.finish()
}
#[inline]
pub fn id(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Extension::VT_ID, None)}
}
#[inline]
pub fn storage_dtype(&self) -> Option<DType<'a>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<DType>>(Extension::VT_STORAGE_DTYPE, None)}
}
#[inline]
pub fn metadata(&self) -> Option<flatbuffers::Vector<'a, u8>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Extension::VT_METADATA, None)}
}
}
impl flatbuffers::Verifiable for Extension<'_> {
#[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<DType>>("storage_dtype", Self::VT_STORAGE_DTYPE, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("metadata", Self::VT_METADATA, false)?
.finish();
Ok(())
}
}
pub struct ExtensionArgs<'a> {
pub id: Option<flatbuffers::WIPOffset<&'a str>>,
pub storage_dtype: Option<flatbuffers::WIPOffset<DType<'a>>>,
pub metadata: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for ExtensionArgs<'a> {
#[inline]
fn default() -> Self {
ExtensionArgs {
id: None,
storage_dtype: None,
metadata: None,
}
}
}
pub struct ExtensionBuilder<'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> ExtensionBuilder<'a, 'b, A> {
#[inline]
pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Extension::VT_ID, id);
}
#[inline]
pub fn add_storage_dtype(&mut self, storage_dtype: flatbuffers::WIPOffset<DType<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<DType>>(Extension::VT_STORAGE_DTYPE, storage_dtype);
}
#[inline]
pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Extension::VT_METADATA, metadata);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ExtensionBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ExtensionBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Extension<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Extension<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Extension");
ds.field("id", &self.id());
ds.field("storage_dtype", &self.storage_dtype());
ds.field("metadata", &self.metadata());
ds.finish()
}
}
pub enum VariantOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Variant<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Variant<'a> {
type Inner = Variant<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Variant<'a> {
pub const VT_NULLABLE: flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Variant { _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 VariantArgs
) -> flatbuffers::WIPOffset<Variant<'bldr>> {
let mut builder = VariantBuilder::new(_fbb);
builder.add_nullable(args.nullable);
builder.finish()
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Variant::VT_NULLABLE, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for Variant<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.finish();
Ok(())
}
}
pub struct VariantArgs {
pub nullable: bool,
}
impl<'a> Default for VariantArgs {
#[inline]
fn default() -> Self {
VariantArgs {
nullable: false,
}
}
}
pub struct VariantBuilder<'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> VariantBuilder<'a, 'b, A> {
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Variant::VT_NULLABLE, nullable, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VariantBuilder<'a, 'b, A> {
let start = _fbb.start_table();
VariantBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Variant<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Variant<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Variant");
ds.field("nullable", &self.nullable());
ds.finish()
}
}
pub enum DTypeOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct DType<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for DType<'a> {
type Inner = DType<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> DType<'a> {
pub const VT_TYPE_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_TYPE_: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
DType { _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 DTypeArgs
) -> flatbuffers::WIPOffset<DType<'bldr>> {
let mut builder = DTypeBuilder::new(_fbb);
if let Some(x) = args.type_ { builder.add_type_(x); }
builder.add_type_type(args.type_type);
builder.finish()
}
#[inline]
pub fn type_type(&self) -> Type {
unsafe { self._tab.get::<Type>(DType::VT_TYPE_TYPE, Some(Type::NONE)).unwrap()}
}
#[inline]
pub fn type_(&self) -> Option<flatbuffers::Table<'a>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(DType::VT_TYPE_, None)}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_null(&self) -> Option<Null<'a>> {
if self.type_type() == Type::Null {
self.type_().map(|t| {
unsafe { Null::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_bool(&self) -> Option<Bool<'a>> {
if self.type_type() == Type::Bool {
self.type_().map(|t| {
unsafe { Bool::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_primitive(&self) -> Option<Primitive<'a>> {
if self.type_type() == Type::Primitive {
self.type_().map(|t| {
unsafe { Primitive::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_decimal(&self) -> Option<Decimal<'a>> {
if self.type_type() == Type::Decimal {
self.type_().map(|t| {
unsafe { Decimal::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_utf_8(&self) -> Option<Utf8<'a>> {
if self.type_type() == Type::Utf8 {
self.type_().map(|t| {
unsafe { Utf8::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_binary(&self) -> Option<Binary<'a>> {
if self.type_type() == Type::Binary {
self.type_().map(|t| {
unsafe { Binary::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_struct_(&self) -> Option<Struct_<'a>> {
if self.type_type() == Type::Struct_ {
self.type_().map(|t| {
unsafe { Struct_::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_list(&self) -> Option<List<'a>> {
if self.type_type() == Type::List {
self.type_().map(|t| {
unsafe { List::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_extension(&self) -> Option<Extension<'a>> {
if self.type_type() == Type::Extension {
self.type_().map(|t| {
unsafe { Extension::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_fixed_size_list(&self) -> Option<FixedSizeList<'a>> {
if self.type_type() == Type::FixedSizeList {
self.type_().map(|t| {
unsafe { FixedSizeList::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_variant(&self) -> Option<Variant<'a>> {
if self.type_type() == Type::Variant {
self.type_().map(|t| {
unsafe { Variant::init_from_table(t) }
})
} else {
None
}
}
}
impl flatbuffers::Verifiable for DType<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_union::<Type, _>("type_type", Self::VT_TYPE_TYPE, "type_", Self::VT_TYPE_, false, |key, v, pos| {
match key {
Type::Null => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Null>>("Type::Null", pos),
Type::Bool => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Bool>>("Type::Bool", pos),
Type::Primitive => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Primitive>>("Type::Primitive", pos),
Type::Decimal => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Decimal>>("Type::Decimal", pos),
Type::Utf8 => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Utf8>>("Type::Utf8", pos),
Type::Binary => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Binary>>("Type::Binary", pos),
Type::Struct_ => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Struct_>>("Type::Struct_", pos),
Type::List => v.verify_union_variant::<flatbuffers::ForwardsUOffset<List>>("Type::List", pos),
Type::Extension => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Extension>>("Type::Extension", pos),
Type::FixedSizeList => v.verify_union_variant::<flatbuffers::ForwardsUOffset<FixedSizeList>>("Type::FixedSizeList", pos),
Type::Variant => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Variant>>("Type::Variant", pos),
_ => Ok(()),
}
})?
.finish();
Ok(())
}
}
pub struct DTypeArgs {
pub type_type: Type,
pub type_: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for DTypeArgs {
#[inline]
fn default() -> Self {
DTypeArgs {
type_type: Type::NONE,
type_: None,
}
}
}
pub struct DTypeBuilder<'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> DTypeBuilder<'a, 'b, A> {
#[inline]
pub fn add_type_type(&mut self, type_type: Type) {
self.fbb_.push_slot::<Type>(DType::VT_TYPE_TYPE, type_type, Type::NONE);
}
#[inline]
pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DType::VT_TYPE_, type_);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DTypeBuilder<'a, 'b, A> {
let start = _fbb.start_table();
DTypeBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<DType<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for DType<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("DType");
ds.field("type_type", &self.type_type());
match self.type_type() {
Type::Null => {
if let Some(x) = self.type__as_null() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Bool => {
if let Some(x) = self.type__as_bool() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Primitive => {
if let Some(x) = self.type__as_primitive() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Decimal => {
if let Some(x) = self.type__as_decimal() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Utf8 => {
if let Some(x) = self.type__as_utf_8() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Binary => {
if let Some(x) = self.type__as_binary() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Struct_ => {
if let Some(x) = self.type__as_struct_() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::List => {
if let Some(x) = self.type__as_list() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Extension => {
if let Some(x) = self.type__as_extension() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::FixedSizeList => {
if let Some(x) = self.type__as_fixed_size_list() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Type::Variant => {
if let Some(x) = self.type__as_variant() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
_ => {
let x: Option<()> = None;
ds.field("type_", &x)
},
};
ds.finish()
}
}
#[inline]
pub fn root_as_dtype(buf: &[u8]) -> Result<DType, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<DType>(buf)
}
#[inline]
pub fn size_prefixed_root_as_dtype(buf: &[u8]) -> Result<DType, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<DType>(buf)
}
#[inline]
pub fn root_as_dtype_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<DType<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<DType<'b>>(opts, buf)
}
#[inline]
pub fn size_prefixed_root_as_dtype_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<DType<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<DType<'b>>(opts, buf)
}
#[inline]
pub unsafe fn root_as_dtype_unchecked(buf: &[u8]) -> DType {
unsafe { flatbuffers::root_unchecked::<DType>(buf) }
}
#[inline]
pub unsafe fn size_prefixed_root_as_dtype_unchecked(buf: &[u8]) -> DType {
unsafe { flatbuffers::size_prefixed_root_unchecked::<DType>(buf) }
}
#[inline]
pub fn finish_dtype_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<DType<'a>>) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_dtype_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<DType<'a>>) {
fbb.finish_size_prefixed(root, None);
}