Merge commit '0f6aab9da6fe982218a01f4a5b896e65fcced437' as 'third_party/flatbuffers'

This commit is contained in:
Siarhei Fedartsou
2024-06-22 13:33:34 +02:00
1814 changed files with 326902 additions and 0 deletions
@@ -0,0 +1,100 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ABC: i32 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ABC: i32 = 2;
#[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_ABC: [ABC; 3] = [
ABC::void,
ABC::where_,
ABC::stackalloc,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct ABC(pub i32);
#[allow(non_upper_case_globals)]
impl ABC {
pub const void: Self = Self(0);
pub const where_: Self = Self(1);
pub const stackalloc: Self = Self(2);
pub const ENUM_MIN: i32 = 0;
pub const ENUM_MAX: i32 = 2;
pub const ENUM_VALUES: &'static [Self] = &[
Self::void,
Self::where_,
Self::stackalloc,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::void => Some("void"),
Self::where_ => Some("where_"),
Self::stackalloc => Some("stackalloc"),
_ => None,
}
}
}
impl core::fmt::Debug for ABC {
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 ABC {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<i32>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for ABC {
type Output = ABC;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<i32>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for ABC {
type Scalar = i32;
#[inline]
fn to_little_endian(self) -> i32 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i32) -> Self {
let b = i32::from_le(v);
Self(b)
}
}
impl<'a> flatbuffers::Verifiable for ABC {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i32::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for ABC {}
@@ -0,0 +1,210 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum KeywordsInTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct KeywordsInTable<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for KeywordsInTable<'a> {
type Inner = KeywordsInTable<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> KeywordsInTable<'a> {
pub const VT_IS: flatbuffers::VOffsetT = 4;
pub const VT_PRIVATE: flatbuffers::VOffsetT = 6;
pub const VT_TYPE_: flatbuffers::VOffsetT = 8;
pub const VT_DEFAULT: flatbuffers::VOffsetT = 10;
pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.KeywordsInTable"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
KeywordsInTable { _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 KeywordsInTableArgs
) -> flatbuffers::WIPOffset<KeywordsInTable<'bldr>> {
let mut builder = KeywordsInTableBuilder::new(_fbb);
builder.add_type_(args.type_);
builder.add_private(args.private);
builder.add_is(args.is);
builder.add_default(args.default);
builder.finish()
}
pub fn unpack(&self) -> KeywordsInTableT {
let is = self.is();
let private = self.private();
let type_ = self.type_();
let default = self.default();
KeywordsInTableT {
is,
private,
type_,
default,
}
}
#[inline]
pub fn is(&self) -> ABC {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<ABC>(KeywordsInTable::VT_IS, Some(ABC::void)).unwrap()}
}
#[inline]
pub fn private(&self) -> public {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<public>(KeywordsInTable::VT_PRIVATE, Some(public::NONE)).unwrap()}
}
#[inline]
pub fn type_(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(KeywordsInTable::VT_TYPE_, Some(0)).unwrap()}
}
#[inline]
pub fn default(&self) -> bool {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<bool>(KeywordsInTable::VT_DEFAULT, Some(false)).unwrap()}
}
}
impl flatbuffers::Verifiable for KeywordsInTable<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<ABC>("is", Self::VT_IS, false)?
.visit_field::<public>("private", Self::VT_PRIVATE, false)?
.visit_field::<i32>("type_", Self::VT_TYPE_, false)?
.visit_field::<bool>("default", Self::VT_DEFAULT, false)?
.finish();
Ok(())
}
}
pub struct KeywordsInTableArgs {
pub is: ABC,
pub private: public,
pub type_: i32,
pub default: bool,
}
impl<'a> Default for KeywordsInTableArgs {
#[inline]
fn default() -> Self {
KeywordsInTableArgs {
is: ABC::void,
private: public::NONE,
type_: 0,
default: false,
}
}
}
pub struct KeywordsInTableBuilder<'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> KeywordsInTableBuilder<'a, 'b, A> {
#[inline]
pub fn add_is(&mut self, is: ABC) {
self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void);
}
#[inline]
pub fn add_private(&mut self, private: public) {
self.fbb_.push_slot::<public>(KeywordsInTable::VT_PRIVATE, private, public::NONE);
}
#[inline]
pub fn add_type_(&mut self, type_: i32) {
self.fbb_.push_slot::<i32>(KeywordsInTable::VT_TYPE_, type_, 0);
}
#[inline]
pub fn add_default(&mut self, default: bool) {
self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> {
let start = _fbb.start_table();
KeywordsInTableBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<KeywordsInTable<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for KeywordsInTable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("KeywordsInTable");
ds.field("is", &self.is());
ds.field("private", &self.private());
ds.field("type_", &self.type_());
ds.field("default", &self.default());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct KeywordsInTableT {
pub is: ABC,
pub private: public,
pub type_: i32,
pub default: bool,
}
impl Default for KeywordsInTableT {
fn default() -> Self {
Self {
is: ABC::void,
private: public::NONE,
type_: 0,
default: false,
}
}
}
impl KeywordsInTableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<KeywordsInTable<'b>> {
let is = self.is;
let private = self.private;
let type_ = self.type_;
let default = self.default;
KeywordsInTable::create(_fbb, &KeywordsInTableArgs{
is,
private,
type_,
default,
})
}
}
@@ -0,0 +1,173 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_KEYWORDS_IN_UNION: u8 = 2;
#[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_KEYWORDS_IN_UNION: [KeywordsInUnion; 3] = [
KeywordsInUnion::NONE,
KeywordsInUnion::static_,
KeywordsInUnion::internal,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct KeywordsInUnion(pub u8);
#[allow(non_upper_case_globals)]
impl KeywordsInUnion {
pub const NONE: Self = Self(0);
pub const static_: Self = Self(1);
pub const internal: Self = Self(2);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 2;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::static_,
Self::internal,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::static_ => Some("static_"),
Self::internal => Some("internal"),
_ => None,
}
}
}
impl core::fmt::Debug for KeywordsInUnion {
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 KeywordsInUnion {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for KeywordsInUnion {
type Output = KeywordsInUnion;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for KeywordsInUnion {
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 KeywordsInUnion {
#[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 KeywordsInUnion {}
pub struct KeywordsInUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub enum KeywordsInUnionT {
NONE,
Static_(Box<KeywordsInTableT>),
Internal(Box<KeywordsInTableT>),
}
impl Default for KeywordsInUnionT {
fn default() -> Self {
Self::NONE
}
}
impl KeywordsInUnionT {
pub fn keywords_in_union_type(&self) -> KeywordsInUnion {
match self {
Self::NONE => KeywordsInUnion::NONE,
Self::Static_(_) => KeywordsInUnion::static_,
Self::Internal(_) => KeywordsInUnion::internal,
}
}
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
match self {
Self::NONE => None,
Self::Static_(v) => Some(v.pack(fbb).as_union_value()),
Self::Internal(v) => Some(v.pack(fbb).as_union_value()),
}
}
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_static_(&mut self) -> Option<Box<KeywordsInTableT>> {
if let Self::Static_(_) = self {
let v = core::mem::replace(self, Self::NONE);
if let Self::Static_(w) = v {
Some(w)
} else {
unreachable!()
}
} else {
None
}
}
/// If the union variant matches, return a reference to the KeywordsInTableT.
pub fn as_static_(&self) -> Option<&KeywordsInTableT> {
if let Self::Static_(v) = self { Some(v.as_ref()) } else { None }
}
/// If the union variant matches, return a mutable reference to the KeywordsInTableT.
pub fn as_static__mut(&mut self) -> Option<&mut KeywordsInTableT> {
if let Self::Static_(v) = self { Some(v.as_mut()) } else { None }
}
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_internal(&mut self) -> Option<Box<KeywordsInTableT>> {
if let Self::Internal(_) = self {
let v = core::mem::replace(self, Self::NONE);
if let Self::Internal(w) = v {
Some(w)
} else {
unreachable!()
}
} else {
None
}
}
/// If the union variant matches, return a reference to the KeywordsInTableT.
pub fn as_internal(&self) -> Option<&KeywordsInTableT> {
if let Self::Internal(v) = self { Some(v.as_ref()) } else { None }
}
/// If the union variant matches, return a mutable reference to the KeywordsInTableT.
pub fn as_internal_mut(&mut self) -> Option<&mut KeywordsInTableT> {
if let Self::Internal(v) = self { Some(v.as_mut()) } else { None }
}
}
@@ -0,0 +1,92 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_PUBLIC: i32 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_PUBLIC: i32 = 0;
#[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_PUBLIC: [public; 1] = [
public::NONE,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct public(pub i32);
#[allow(non_upper_case_globals)]
impl public {
pub const NONE: Self = Self(0);
pub const ENUM_MIN: i32 = 0;
pub const ENUM_MAX: i32 = 0;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
_ => None,
}
}
}
impl core::fmt::Debug for public {
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 public {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<i32>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for public {
type Output = public;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<i32>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for public {
type Scalar = i32;
#[inline]
fn to_little_endian(self) -> i32 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i32) -> Self {
let b = i32::from_le(v);
Self(b)
}
}
impl<'a> flatbuffers::Verifiable for public {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i32::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for public {}
@@ -0,0 +1,227 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum Table2Offset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Table2<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Table2<'a> {
type Inner = Table2<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Table2<'a> {
pub const VT_TYPE_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_TYPE_: flatbuffers::VOffsetT = 6;
pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.Table2"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Table2 { _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 Table2Args
) -> flatbuffers::WIPOffset<Table2<'bldr>> {
let mut builder = Table2Builder::new(_fbb);
if let Some(x) = args.type_ { builder.add_type_(x); }
builder.add_type_type(args.type_type);
builder.finish()
}
pub fn unpack(&self) -> Table2T {
let type_ = match self.type_type() {
KeywordsInUnion::NONE => KeywordsInUnionT::NONE,
KeywordsInUnion::static_ => KeywordsInUnionT::Static_(Box::new(
self.type__as_static_()
.expect("Invalid union table, expected `KeywordsInUnion::static_`.")
.unpack()
)),
KeywordsInUnion::internal => KeywordsInUnionT::Internal(Box::new(
self.type__as_internal()
.expect("Invalid union table, expected `KeywordsInUnion::internal`.")
.unpack()
)),
_ => KeywordsInUnionT::NONE,
};
Table2T {
type_,
}
}
#[inline]
pub fn type_type(&self) -> KeywordsInUnion {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, Some(KeywordsInUnion::NONE)).unwrap()}
}
#[inline]
pub fn type_(&self) -> Option<flatbuffers::Table<'a>> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_static_(&self) -> Option<KeywordsInTable<'a>> {
if self.type_type() == KeywordsInUnion::static_ {
self.type_().map(|t| {
// Safety:
// Created from a valid Table for this object
// Which contains a valid union in this slot
unsafe { KeywordsInTable::init_from_table(t) }
})
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn type__as_internal(&self) -> Option<KeywordsInTable<'a>> {
if self.type_type() == KeywordsInUnion::internal {
self.type_().map(|t| {
// Safety:
// Created from a valid Table for this object
// Which contains a valid union in this slot
unsafe { KeywordsInTable::init_from_table(t) }
})
} else {
None
}
}
}
impl flatbuffers::Verifiable for Table2<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_union::<KeywordsInUnion, _>("type_type", Self::VT_TYPE_TYPE, "type_", Self::VT_TYPE_, false, |key, v, pos| {
match key {
KeywordsInUnion::static_ => v.verify_union_variant::<flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::static_", pos),
KeywordsInUnion::internal => v.verify_union_variant::<flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::internal", pos),
_ => Ok(()),
}
})?
.finish();
Ok(())
}
}
pub struct Table2Args {
pub type_type: KeywordsInUnion,
pub type_: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for Table2Args {
#[inline]
fn default() -> Self {
Table2Args {
type_type: KeywordsInUnion::NONE,
type_: None,
}
}
}
pub struct Table2Builder<'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> Table2Builder<'a, 'b, A> {
#[inline]
pub fn add_type_type(&mut self, type_type: KeywordsInUnion) {
self.fbb_.push_slot::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, type_type, KeywordsInUnion::NONE);
}
#[inline]
pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> {
let start = _fbb.start_table();
Table2Builder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Table2<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Table2<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Table2");
ds.field("type_type", &self.type_type());
match self.type_type() {
KeywordsInUnion::static_ => {
if let Some(x) = self.type__as_static_() {
ds.field("type_", &x)
} else {
ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
KeywordsInUnion::internal => {
if let Some(x) = self.type__as_internal() {
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()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct Table2T {
pub type_: KeywordsInUnionT,
}
impl Default for Table2T {
fn default() -> Self {
Self {
type_: KeywordsInUnionT::NONE,
}
}
}
impl Table2T {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Table2<'b>> {
let type_type = self.type_.keywords_in_union_type();
let type_ = self.type_.pack(_fbb);
Table2::create(_fbb, &Table2Args{
type_type,
type_,
})
}
}
+15
View File
@@ -0,0 +1,15 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
// @generated
pub mod keyword_test {
use super::*;
mod abc_generated;
pub use self::abc_generated::*;
mod public_generated;
pub use self::public_generated::*;
mod keywords_in_union_generated;
pub use self::keywords_in_union_generated::*;
mod keywords_in_table_generated;
pub use self::keywords_in_table_generated::*;
mod table_2_generated;
pub use self::table_2_generated::*;
} // keyword_test