Merge commit '0f6aab9da6fe982218a01f4a5b896e65fcced437' as 'third_party/flatbuffers'
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
// Automatically generated by the Flatbuffers compiler. Do not modify.
|
||||
// @generated
|
||||
pub mod my_game {
|
||||
use super::*;
|
||||
pub mod example {
|
||||
use super::*;
|
||||
mod color_generated;
|
||||
pub use self::color_generated::*;
|
||||
mod race_generated;
|
||||
pub use self::race_generated::*;
|
||||
mod long_enum_generated;
|
||||
pub use self::long_enum_generated::*;
|
||||
mod any_generated;
|
||||
pub use self::any_generated::*;
|
||||
mod any_unique_aliases_generated;
|
||||
pub use self::any_unique_aliases_generated::*;
|
||||
mod any_ambiguous_aliases_generated;
|
||||
pub use self::any_ambiguous_aliases_generated::*;
|
||||
mod test_generated;
|
||||
pub use self::test_generated::*;
|
||||
mod test_simple_table_with_enum_generated;
|
||||
pub use self::test_simple_table_with_enum_generated::*;
|
||||
mod vec_3_generated;
|
||||
pub use self::vec_3_generated::*;
|
||||
mod ability_generated;
|
||||
pub use self::ability_generated::*;
|
||||
mod struct_of_structs_generated;
|
||||
pub use self::struct_of_structs_generated::*;
|
||||
mod struct_of_structs_of_structs_generated;
|
||||
pub use self::struct_of_structs_of_structs_generated::*;
|
||||
mod stat_generated;
|
||||
pub use self::stat_generated::*;
|
||||
mod referrable_generated;
|
||||
pub use self::referrable_generated::*;
|
||||
mod monster_generated;
|
||||
pub use self::monster_generated::*;
|
||||
mod type_aliases_generated;
|
||||
pub use self::type_aliases_generated::*;
|
||||
} // example
|
||||
pub mod example_2 {
|
||||
use super::*;
|
||||
mod monster_generated;
|
||||
pub use self::monster_generated::*;
|
||||
} // example_2
|
||||
pub mod other_name_space {
|
||||
use super::*;
|
||||
mod from_include_generated;
|
||||
pub use self::from_include_generated::*;
|
||||
mod unused_generated;
|
||||
pub use self::unused_generated::*;
|
||||
mod table_b_generated;
|
||||
pub use self::table_b_generated::*;
|
||||
} // other_name_space
|
||||
mod in_parent_namespace_generated;
|
||||
pub use self::in_parent_namespace_generated::*;
|
||||
} // my_game
|
||||
mod table_a_generated;
|
||||
pub use self::table_a_generated::*;
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
// 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::*;
|
||||
// struct Ability, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct Ability(pub [u8; 8]);
|
||||
impl Default for Ability {
|
||||
fn default() -> Self {
|
||||
Self([0; 8])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Ability {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("Ability")
|
||||
.field("id", &self.id())
|
||||
.field("distance", &self.distance())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Ability {}
|
||||
impl<'a> flatbuffers::Follow<'a> for Ability {
|
||||
type Inner = &'a Ability;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a Ability>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a Ability {
|
||||
type Inner = &'a Ability;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<Ability>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for Ability {
|
||||
type Output = Ability;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const Ability as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Ability {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Ability {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
id: u32,
|
||||
distance: u32,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 8]);
|
||||
s.set_id(id);
|
||||
s.set_distance(distance);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.Ability"
|
||||
}
|
||||
|
||||
pub fn id(&self) -> u32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<u32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_id(&mut self, x: u32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn key_compare_less_than(&self, o: &Ability) -> bool {
|
||||
self.id() < o.id()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn key_compare_with_value(&self, val: u32) -> ::core::cmp::Ordering {
|
||||
let key = self.id();
|
||||
key.cmp(&val)
|
||||
}
|
||||
pub fn distance(&self) -> u32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<u32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[4..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_distance(&mut self, x: u32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[4..].as_mut_ptr(),
|
||||
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> AbilityT {
|
||||
AbilityT {
|
||||
id: self.id(),
|
||||
distance: self.distance(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct AbilityT {
|
||||
pub id: u32,
|
||||
pub distance: u32,
|
||||
}
|
||||
impl AbilityT {
|
||||
pub fn pack(&self) -> Ability {
|
||||
Ability::new(
|
||||
self.id,
|
||||
self.distance,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+201
@@ -0,0 +1,201 @@
|
||||
// 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_ANY_AMBIGUOUS_ALIASES: u8 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
|
||||
#[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_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
|
||||
AnyAmbiguousAliases::NONE,
|
||||
AnyAmbiguousAliases::M1,
|
||||
AnyAmbiguousAliases::M2,
|
||||
AnyAmbiguousAliases::M3,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct AnyAmbiguousAliases(pub u8);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl AnyAmbiguousAliases {
|
||||
pub const NONE: Self = Self(0);
|
||||
pub const M1: Self = Self(1);
|
||||
pub const M2: Self = Self(2);
|
||||
pub const M3: Self = Self(3);
|
||||
|
||||
pub const ENUM_MIN: u8 = 0;
|
||||
pub const ENUM_MAX: u8 = 3;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::NONE,
|
||||
Self::M1,
|
||||
Self::M2,
|
||||
Self::M3,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::NONE => Some("NONE"),
|
||||
Self::M1 => Some("M1"),
|
||||
Self::M2 => Some("M2"),
|
||||
Self::M3 => Some("M3"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for AnyAmbiguousAliases {
|
||||
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 AnyAmbiguousAliases {
|
||||
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 AnyAmbiguousAliases {
|
||||
type Output = AnyAmbiguousAliases;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<u8>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
|
||||
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 AnyAmbiguousAliases {
|
||||
#[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 AnyAmbiguousAliases {}
|
||||
pub struct AnyAmbiguousAliasesUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum AnyAmbiguousAliasesT {
|
||||
NONE,
|
||||
M1(Box<MonsterT>),
|
||||
M2(Box<MonsterT>),
|
||||
M3(Box<MonsterT>),
|
||||
}
|
||||
impl Default for AnyAmbiguousAliasesT {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
impl AnyAmbiguousAliasesT {
|
||||
pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases {
|
||||
match self {
|
||||
Self::NONE => AnyAmbiguousAliases::NONE,
|
||||
Self::M1(_) => AnyAmbiguousAliases::M1,
|
||||
Self::M2(_) => AnyAmbiguousAliases::M2,
|
||||
Self::M3(_) => AnyAmbiguousAliases::M3,
|
||||
}
|
||||
}
|
||||
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::M1(v) => Some(v.pack(fbb).as_union_value()),
|
||||
Self::M2(v) => Some(v.pack(fbb).as_union_value()),
|
||||
Self::M3(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
|
||||
pub fn take_m1(&mut self) -> Option<Box<MonsterT>> {
|
||||
if let Self::M1(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::M1(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the MonsterT.
|
||||
pub fn as_m1(&self) -> Option<&MonsterT> {
|
||||
if let Self::M1(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the MonsterT.
|
||||
pub fn as_m1_mut(&mut self) -> Option<&mut MonsterT> {
|
||||
if let Self::M1(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
|
||||
pub fn take_m2(&mut self) -> Option<Box<MonsterT>> {
|
||||
if let Self::M2(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::M2(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the MonsterT.
|
||||
pub fn as_m2(&self) -> Option<&MonsterT> {
|
||||
if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the MonsterT.
|
||||
pub fn as_m2_mut(&mut self) -> Option<&mut MonsterT> {
|
||||
if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
|
||||
pub fn take_m3(&mut self) -> Option<Box<MonsterT>> {
|
||||
if let Self::M3(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::M3(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the MonsterT.
|
||||
pub fn as_m3(&self) -> Option<&MonsterT> {
|
||||
if let Self::M3(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the MonsterT.
|
||||
pub fn as_m3_mut(&mut self) -> Option<&mut MonsterT> {
|
||||
if let Self::M3(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
// 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_ANY: u8 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_ANY: u8 = 3;
|
||||
#[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_ANY: [Any; 4] = [
|
||||
Any::NONE,
|
||||
Any::Monster,
|
||||
Any::TestSimpleTableWithEnum,
|
||||
Any::MyGame_Example2_Monster,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct Any(pub u8);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl Any {
|
||||
pub const NONE: Self = Self(0);
|
||||
pub const Monster: Self = Self(1);
|
||||
pub const TestSimpleTableWithEnum: Self = Self(2);
|
||||
pub const MyGame_Example2_Monster: Self = Self(3);
|
||||
|
||||
pub const ENUM_MIN: u8 = 0;
|
||||
pub const ENUM_MAX: u8 = 3;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::NONE,
|
||||
Self::Monster,
|
||||
Self::TestSimpleTableWithEnum,
|
||||
Self::MyGame_Example2_Monster,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::NONE => Some("NONE"),
|
||||
Self::Monster => Some("Monster"),
|
||||
Self::TestSimpleTableWithEnum => Some("TestSimpleTableWithEnum"),
|
||||
Self::MyGame_Example2_Monster => Some("MyGame_Example2_Monster"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Any {
|
||||
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 Any {
|
||||
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 Any {
|
||||
type Output = Any;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<u8>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for Any {
|
||||
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 Any {
|
||||
#[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 Any {}
|
||||
pub struct AnyUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum AnyT {
|
||||
NONE,
|
||||
Monster(Box<MonsterT>),
|
||||
TestSimpleTableWithEnum(Box<TestSimpleTableWithEnumT>),
|
||||
MyGameExample2Monster(Box<super::example_2::MonsterT>),
|
||||
}
|
||||
impl Default for AnyT {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
impl AnyT {
|
||||
pub fn any_type(&self) -> Any {
|
||||
match self {
|
||||
Self::NONE => Any::NONE,
|
||||
Self::Monster(_) => Any::Monster,
|
||||
Self::TestSimpleTableWithEnum(_) => Any::TestSimpleTableWithEnum,
|
||||
Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster,
|
||||
}
|
||||
}
|
||||
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::Monster(v) => Some(v.pack(fbb).as_union_value()),
|
||||
Self::TestSimpleTableWithEnum(v) => Some(v.pack(fbb).as_union_value()),
|
||||
Self::MyGameExample2Monster(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
|
||||
pub fn take_monster(&mut self) -> Option<Box<MonsterT>> {
|
||||
if let Self::Monster(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::Monster(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the MonsterT.
|
||||
pub fn as_monster(&self) -> Option<&MonsterT> {
|
||||
if let Self::Monster(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the MonsterT.
|
||||
pub fn as_monster_mut(&mut self) -> Option<&mut MonsterT> {
|
||||
if let Self::Monster(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
|
||||
pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
|
||||
if let Self::TestSimpleTableWithEnum(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::TestSimpleTableWithEnum(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
|
||||
pub fn as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT> {
|
||||
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
|
||||
pub fn as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
|
||||
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
|
||||
pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> {
|
||||
if let Self::MyGameExample2Monster(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::MyGameExample2Monster(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the super::example_2::MonsterT.
|
||||
pub fn as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT> {
|
||||
if let Self::MyGameExample2Monster(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
|
||||
pub fn as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
|
||||
if let Self::MyGameExample2Monster(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
}
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
// 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_ANY_UNIQUE_ALIASES: u8 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
|
||||
#[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_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
|
||||
AnyUniqueAliases::NONE,
|
||||
AnyUniqueAliases::M,
|
||||
AnyUniqueAliases::TS,
|
||||
AnyUniqueAliases::M2,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct AnyUniqueAliases(pub u8);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl AnyUniqueAliases {
|
||||
pub const NONE: Self = Self(0);
|
||||
pub const M: Self = Self(1);
|
||||
pub const TS: Self = Self(2);
|
||||
pub const M2: Self = Self(3);
|
||||
|
||||
pub const ENUM_MIN: u8 = 0;
|
||||
pub const ENUM_MAX: u8 = 3;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::NONE,
|
||||
Self::M,
|
||||
Self::TS,
|
||||
Self::M2,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::NONE => Some("NONE"),
|
||||
Self::M => Some("M"),
|
||||
Self::TS => Some("TS"),
|
||||
Self::M2 => Some("M2"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for AnyUniqueAliases {
|
||||
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 AnyUniqueAliases {
|
||||
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 AnyUniqueAliases {
|
||||
type Output = AnyUniqueAliases;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<u8>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for AnyUniqueAliases {
|
||||
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 AnyUniqueAliases {
|
||||
#[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 AnyUniqueAliases {}
|
||||
pub struct AnyUniqueAliasesUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum AnyUniqueAliasesT {
|
||||
NONE,
|
||||
M(Box<MonsterT>),
|
||||
TS(Box<TestSimpleTableWithEnumT>),
|
||||
M2(Box<super::example_2::MonsterT>),
|
||||
}
|
||||
impl Default for AnyUniqueAliasesT {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
impl AnyUniqueAliasesT {
|
||||
pub fn any_unique_aliases_type(&self) -> AnyUniqueAliases {
|
||||
match self {
|
||||
Self::NONE => AnyUniqueAliases::NONE,
|
||||
Self::M(_) => AnyUniqueAliases::M,
|
||||
Self::TS(_) => AnyUniqueAliases::TS,
|
||||
Self::M2(_) => AnyUniqueAliases::M2,
|
||||
}
|
||||
}
|
||||
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::M(v) => Some(v.pack(fbb).as_union_value()),
|
||||
Self::TS(v) => Some(v.pack(fbb).as_union_value()),
|
||||
Self::M2(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
|
||||
pub fn take_m(&mut self) -> Option<Box<MonsterT>> {
|
||||
if let Self::M(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::M(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the MonsterT.
|
||||
pub fn as_m(&self) -> Option<&MonsterT> {
|
||||
if let Self::M(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the MonsterT.
|
||||
pub fn as_m_mut(&mut self) -> Option<&mut MonsterT> {
|
||||
if let Self::M(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
|
||||
pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
|
||||
if let Self::TS(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::TS(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
|
||||
pub fn as_ts(&self) -> Option<&TestSimpleTableWithEnumT> {
|
||||
if let Self::TS(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
|
||||
pub fn as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
|
||||
if let Self::TS(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
|
||||
pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> {
|
||||
if let Self::M2(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::M2(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the super::example_2::MonsterT.
|
||||
pub fn as_m2(&self) -> Option<&super::example_2::MonsterT> {
|
||||
if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
|
||||
pub fn as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
|
||||
if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// 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::*;
|
||||
#[allow(non_upper_case_globals)]
|
||||
mod bitflags_color {
|
||||
flatbuffers::bitflags::bitflags! {
|
||||
/// Composite components of Monster color.
|
||||
#[derive(Default)]
|
||||
pub struct Color: u8 {
|
||||
const Red = 1;
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
const Green = 2;
|
||||
/// \brief color Blue (1u << 3)
|
||||
const Blue = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
pub use self::bitflags_color::Color;
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Color {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
|
||||
// Safety:
|
||||
// This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
|
||||
// from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
|
||||
// https://github.com/bitflags/bitflags/issues/262
|
||||
Self::from_bits_unchecked(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for Color {
|
||||
type Output = Color;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<u8>(dst, self.bits());
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for Color {
|
||||
type Scalar = u8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
self.bits().to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: u8) -> Self {
|
||||
let b = u8::from_le(v);
|
||||
// Safety:
|
||||
// This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
|
||||
// from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
|
||||
// https://github.com/bitflags/bitflags/issues/262
|
||||
unsafe { Self::from_bits_unchecked(b) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Color {
|
||||
#[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 Color {}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
// 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::*;
|
||||
#[allow(non_upper_case_globals)]
|
||||
mod bitflags_long_enum {
|
||||
flatbuffers::bitflags::bitflags! {
|
||||
#[derive(Default)]
|
||||
pub struct LongEnum: u64 {
|
||||
const LongOne = 2;
|
||||
const LongTwo = 4;
|
||||
const LongBig = 1099511627776;
|
||||
}
|
||||
}
|
||||
}
|
||||
pub use self::bitflags_long_enum::LongEnum;
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for LongEnum {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<u64>(buf, loc);
|
||||
// Safety:
|
||||
// This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
|
||||
// from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
|
||||
// https://github.com/bitflags/bitflags/issues/262
|
||||
Self::from_bits_unchecked(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for LongEnum {
|
||||
type Output = LongEnum;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<u64>(dst, self.bits());
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for LongEnum {
|
||||
type Scalar = u64;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u64 {
|
||||
self.bits().to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: u64) -> Self {
|
||||
let b = u64::from_le(v);
|
||||
// Safety:
|
||||
// This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
|
||||
// from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
|
||||
// https://github.com/bitflags/bitflags/issues/262
|
||||
unsafe { Self::from_bits_unchecked(b) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for LongEnum {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
u64::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for LongEnum {}
|
||||
+2015
File diff suppressed because it is too large
Load Diff
+104
@@ -0,0 +1,104 @@
|
||||
// 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_RACE: i8 = -1;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_RACE: i8 = 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_RACE: [Race; 4] = [
|
||||
Race::None,
|
||||
Race::Human,
|
||||
Race::Dwarf,
|
||||
Race::Elf,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct Race(pub i8);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl Race {
|
||||
pub const None: Self = Self(-1);
|
||||
pub const Human: Self = Self(0);
|
||||
pub const Dwarf: Self = Self(1);
|
||||
pub const Elf: Self = Self(2);
|
||||
|
||||
pub const ENUM_MIN: i8 = -1;
|
||||
pub const ENUM_MAX: i8 = 2;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::None,
|
||||
Self::Human,
|
||||
Self::Dwarf,
|
||||
Self::Elf,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::None => Some("None"),
|
||||
Self::Human => Some("Human"),
|
||||
Self::Dwarf => Some("Dwarf"),
|
||||
Self::Elf => Some("Elf"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Race {
|
||||
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 Race {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<i8>(buf, loc);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for Race {
|
||||
type Output = Race;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<i8>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for Race {
|
||||
type Scalar = i8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i8 {
|
||||
self.0.to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: i8) -> Self {
|
||||
let b = i8::from_le(v);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Race {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
i8::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Race {}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
// 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 ReferrableOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct Referrable<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Referrable<'a> {
|
||||
type Inner = Referrable<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Referrable<'a> {
|
||||
pub const VT_ID: flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.Referrable"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
Referrable { _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 ReferrableArgs
|
||||
) -> flatbuffers::WIPOffset<Referrable<'bldr>> {
|
||||
let mut builder = ReferrableBuilder::new(_fbb);
|
||||
builder.add_id(args.id);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> ReferrableT {
|
||||
let id = self.id();
|
||||
ReferrableT {
|
||||
id,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn id(&self) -> u64 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn key_compare_less_than(&self, o: &Referrable) -> bool {
|
||||
self.id() < o.id()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn key_compare_with_value(&self, val: u64) -> ::core::cmp::Ordering {
|
||||
let key = self.id();
|
||||
key.cmp(&val)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for Referrable<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<u64>("id", Self::VT_ID, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct ReferrableArgs {
|
||||
pub id: u64,
|
||||
}
|
||||
impl<'a> Default for ReferrableArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
ReferrableArgs {
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ReferrableBuilder<'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> ReferrableBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_id(&mut self, id: u64) {
|
||||
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
ReferrableBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<Referrable<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Referrable<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Referrable");
|
||||
ds.field("id", &self.id());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ReferrableT {
|
||||
pub id: u64,
|
||||
}
|
||||
impl Default for ReferrableT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ReferrableT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<Referrable<'b>> {
|
||||
let id = self.id;
|
||||
Referrable::create(_fbb, &ReferrableArgs{
|
||||
id,
|
||||
})
|
||||
}
|
||||
}
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
// 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 StatOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct Stat<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Stat<'a> {
|
||||
type Inner = Stat<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Stat<'a> {
|
||||
pub const VT_ID: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_VAL: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_COUNT: flatbuffers::VOffsetT = 8;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.Stat"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
Stat { _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 StatArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<Stat<'bldr>> {
|
||||
let mut builder = StatBuilder::new(_fbb);
|
||||
builder.add_val(args.val);
|
||||
if let Some(x) = args.id { builder.add_id(x); }
|
||||
builder.add_count(args.count);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> StatT {
|
||||
let id = self.id().map(|x| {
|
||||
x.to_string()
|
||||
});
|
||||
let val = self.val();
|
||||
let count = self.count();
|
||||
StatT {
|
||||
id,
|
||||
val,
|
||||
count,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn id(&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>>(Stat::VT_ID, None)}
|
||||
}
|
||||
#[inline]
|
||||
pub fn val(&self) -> i64 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn count(&self) -> u16 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn key_compare_less_than(&self, o: &Stat) -> bool {
|
||||
self.count() < o.count()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn key_compare_with_value(&self, val: u16) -> ::core::cmp::Ordering {
|
||||
let key = self.count();
|
||||
key.cmp(&val)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for Stat<'_> {
|
||||
#[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::<i64>("val", Self::VT_VAL, false)?
|
||||
.visit_field::<u16>("count", Self::VT_COUNT, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct StatArgs<'a> {
|
||||
pub id: Option<flatbuffers::WIPOffset<&'a str>>,
|
||||
pub val: i64,
|
||||
pub count: u16,
|
||||
}
|
||||
impl<'a> Default for StatArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
StatArgs {
|
||||
id: None,
|
||||
val: 0,
|
||||
count: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct StatBuilder<'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> StatBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_val(&mut self, val: i64) {
|
||||
self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_count(&mut self, count: u16) {
|
||||
self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
StatBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<Stat<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Stat<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Stat");
|
||||
ds.field("id", &self.id());
|
||||
ds.field("val", &self.val());
|
||||
ds.field("count", &self.count());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct StatT {
|
||||
pub id: Option<String>,
|
||||
pub val: i64,
|
||||
pub count: u16,
|
||||
}
|
||||
impl Default for StatT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: None,
|
||||
val: 0,
|
||||
count: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl StatT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<Stat<'b>> {
|
||||
let id = self.id.as_ref().map(|x|{
|
||||
_fbb.create_string(x)
|
||||
});
|
||||
let val = self.val;
|
||||
let count = self.count;
|
||||
Stat::create(_fbb, &StatArgs{
|
||||
id,
|
||||
val,
|
||||
count,
|
||||
})
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
// 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::*;
|
||||
// struct StructOfStructs, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct StructOfStructs(pub [u8; 20]);
|
||||
impl Default for StructOfStructs {
|
||||
fn default() -> Self {
|
||||
Self([0; 20])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for StructOfStructs {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("StructOfStructs")
|
||||
.field("a", &self.a())
|
||||
.field("b", &self.b())
|
||||
.field("c", &self.c())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for StructOfStructs {}
|
||||
impl<'a> flatbuffers::Follow<'a> for StructOfStructs {
|
||||
type Inner = &'a StructOfStructs;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a StructOfStructs>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructs {
|
||||
type Inner = &'a StructOfStructs;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for StructOfStructs {
|
||||
type Output = StructOfStructs;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for StructOfStructs {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StructOfStructs {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: &Ability,
|
||||
b: &Test,
|
||||
c: &Ability,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 20]);
|
||||
s.set_a(a);
|
||||
s.set_b(b);
|
||||
s.set_c(c);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.StructOfStructs"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> &Ability {
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid struct in this slot
|
||||
unsafe { &*(self.0[0..].as_ptr() as *const Ability) }
|
||||
}
|
||||
|
||||
#[allow(clippy::identity_op)]
|
||||
pub fn set_a(&mut self, x: &Ability) {
|
||||
self.0[0..0 + 8].copy_from_slice(&x.0)
|
||||
}
|
||||
|
||||
pub fn b(&self) -> &Test {
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid struct in this slot
|
||||
unsafe { &*(self.0[8..].as_ptr() as *const Test) }
|
||||
}
|
||||
|
||||
#[allow(clippy::identity_op)]
|
||||
pub fn set_b(&mut self, x: &Test) {
|
||||
self.0[8..8 + 4].copy_from_slice(&x.0)
|
||||
}
|
||||
|
||||
pub fn c(&self) -> &Ability {
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid struct in this slot
|
||||
unsafe { &*(self.0[12..].as_ptr() as *const Ability) }
|
||||
}
|
||||
|
||||
#[allow(clippy::identity_op)]
|
||||
pub fn set_c(&mut self, x: &Ability) {
|
||||
self.0[12..12 + 8].copy_from_slice(&x.0)
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> StructOfStructsT {
|
||||
StructOfStructsT {
|
||||
a: self.a().unpack(),
|
||||
b: self.b().unpack(),
|
||||
c: self.c().unpack(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct StructOfStructsT {
|
||||
pub a: AbilityT,
|
||||
pub b: TestT,
|
||||
pub c: AbilityT,
|
||||
}
|
||||
impl StructOfStructsT {
|
||||
pub fn pack(&self) -> StructOfStructs {
|
||||
StructOfStructs::new(
|
||||
&self.a.pack(),
|
||||
&self.b.pack(),
|
||||
&self.c.pack(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
third_party/flatbuffers/tests/monster_test/my_game/example/struct_of_structs_of_structs_generated.rs
Vendored
+107
@@ -0,0 +1,107 @@
|
||||
// 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::*;
|
||||
// struct StructOfStructsOfStructs, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct StructOfStructsOfStructs(pub [u8; 20]);
|
||||
impl Default for StructOfStructsOfStructs {
|
||||
fn default() -> Self {
|
||||
Self([0; 20])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for StructOfStructsOfStructs {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("StructOfStructsOfStructs")
|
||||
.field("a", &self.a())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
|
||||
impl<'a> flatbuffers::Follow<'a> for StructOfStructsOfStructs {
|
||||
type Inner = &'a StructOfStructsOfStructs;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a StructOfStructsOfStructs>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
|
||||
type Inner = &'a StructOfStructsOfStructs;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for StructOfStructsOfStructs {
|
||||
type Output = StructOfStructsOfStructs;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for StructOfStructsOfStructs {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StructOfStructsOfStructs {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: &StructOfStructs,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 20]);
|
||||
s.set_a(a);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.StructOfStructsOfStructs"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> &StructOfStructs {
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid struct in this slot
|
||||
unsafe { &*(self.0[0..].as_ptr() as *const StructOfStructs) }
|
||||
}
|
||||
|
||||
#[allow(clippy::identity_op)]
|
||||
pub fn set_a(&mut self, x: &StructOfStructs) {
|
||||
self.0[0..0 + 20].copy_from_slice(&x.0)
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> StructOfStructsOfStructsT {
|
||||
StructOfStructsOfStructsT {
|
||||
a: self.a().unpack(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct StructOfStructsOfStructsT {
|
||||
pub a: StructOfStructsT,
|
||||
}
|
||||
impl StructOfStructsOfStructsT {
|
||||
pub fn pack(&self) -> StructOfStructsOfStructs {
|
||||
StructOfStructsOfStructs::new(
|
||||
&self.a.pack(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
// 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::*;
|
||||
// struct Test, aligned to 2
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct Test(pub [u8; 4]);
|
||||
impl Default for Test {
|
||||
fn default() -> Self {
|
||||
Self([0; 4])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Test {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("Test")
|
||||
.field("a", &self.a())
|
||||
.field("b", &self.b())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Test {}
|
||||
impl<'a> flatbuffers::Follow<'a> for Test {
|
||||
type Inner = &'a Test;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a Test>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a Test {
|
||||
type Inner = &'a Test;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<Test>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for Test {
|
||||
type Output = Test;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const Test as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Test {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Test {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: i16,
|
||||
b: i8,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 4]);
|
||||
s.set_a(a);
|
||||
s.set_b(b);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.Test"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> i16 {
|
||||
let mut mem = core::mem::MaybeUninit::<<i16 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<i16 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_a(&mut self, x: i16) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
core::mem::size_of::<<i16 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn b(&self) -> i8 {
|
||||
let mut mem = core::mem::MaybeUninit::<<i8 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[2..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_b(&mut self, x: i8) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[2..].as_mut_ptr(),
|
||||
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TestT {
|
||||
TestT {
|
||||
a: self.a(),
|
||||
b: self.b(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct TestT {
|
||||
pub a: i16,
|
||||
pub b: i8,
|
||||
}
|
||||
impl TestT {
|
||||
pub fn pack(&self) -> Test {
|
||||
Test::new(
|
||||
self.a,
|
||||
self.b,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+141
@@ -0,0 +1,141 @@
|
||||
// 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 TestSimpleTableWithEnumOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TestSimpleTableWithEnum<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
|
||||
type Inner = TestSimpleTableWithEnum<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TestSimpleTableWithEnum<'a> {
|
||||
pub const VT_COLOR: flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.TestSimpleTableWithEnum"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TestSimpleTableWithEnum { _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 TestSimpleTableWithEnumArgs
|
||||
) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> {
|
||||
let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb);
|
||||
builder.add_color(args.color);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TestSimpleTableWithEnumT {
|
||||
let color = self.color();
|
||||
TestSimpleTableWithEnumT {
|
||||
color,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn color(&self) -> Color {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<Color>(TestSimpleTableWithEnum::VT_COLOR, Some(Color::Green)).unwrap()}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<Color>("color", Self::VT_COLOR, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TestSimpleTableWithEnumArgs {
|
||||
pub color: Color,
|
||||
}
|
||||
impl<'a> Default for TestSimpleTableWithEnumArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TestSimpleTableWithEnumArgs {
|
||||
color: Color::Green,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TestSimpleTableWithEnumBuilder<'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> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_color(&mut self, color: Color) {
|
||||
self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TestSimpleTableWithEnumBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TestSimpleTableWithEnum<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TestSimpleTableWithEnum");
|
||||
ds.field("color", &self.color());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TestSimpleTableWithEnumT {
|
||||
pub color: Color,
|
||||
}
|
||||
impl Default for TestSimpleTableWithEnumT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
color: Color::Green,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TestSimpleTableWithEnumT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>> {
|
||||
let color = self.color;
|
||||
TestSimpleTableWithEnum::create(_fbb, &TestSimpleTableWithEnumArgs{
|
||||
color,
|
||||
})
|
||||
}
|
||||
}
|
||||
+402
@@ -0,0 +1,402 @@
|
||||
// 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 TypeAliasesOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TypeAliases<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> {
|
||||
type Inner = TypeAliases<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TypeAliases<'a> {
|
||||
pub const VT_I8_: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_U8_: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_I16_: flatbuffers::VOffsetT = 8;
|
||||
pub const VT_U16_: flatbuffers::VOffsetT = 10;
|
||||
pub const VT_I32_: flatbuffers::VOffsetT = 12;
|
||||
pub const VT_U32_: flatbuffers::VOffsetT = 14;
|
||||
pub const VT_I64_: flatbuffers::VOffsetT = 16;
|
||||
pub const VT_U64_: flatbuffers::VOffsetT = 18;
|
||||
pub const VT_F32_: flatbuffers::VOffsetT = 20;
|
||||
pub const VT_F64_: flatbuffers::VOffsetT = 22;
|
||||
pub const VT_V8: flatbuffers::VOffsetT = 24;
|
||||
pub const VT_VF64: flatbuffers::VOffsetT = 26;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.TypeAliases"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TypeAliases { _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 TypeAliasesArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<TypeAliases<'bldr>> {
|
||||
let mut builder = TypeAliasesBuilder::new(_fbb);
|
||||
builder.add_f64_(args.f64_);
|
||||
builder.add_u64_(args.u64_);
|
||||
builder.add_i64_(args.i64_);
|
||||
if let Some(x) = args.vf64 { builder.add_vf64(x); }
|
||||
if let Some(x) = args.v8 { builder.add_v8(x); }
|
||||
builder.add_f32_(args.f32_);
|
||||
builder.add_u32_(args.u32_);
|
||||
builder.add_i32_(args.i32_);
|
||||
builder.add_u16_(args.u16_);
|
||||
builder.add_i16_(args.i16_);
|
||||
builder.add_u8_(args.u8_);
|
||||
builder.add_i8_(args.i8_);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TypeAliasesT {
|
||||
let i8_ = self.i8_();
|
||||
let u8_ = self.u8_();
|
||||
let i16_ = self.i16_();
|
||||
let u16_ = self.u16_();
|
||||
let i32_ = self.i32_();
|
||||
let u32_ = self.u32_();
|
||||
let i64_ = self.i64_();
|
||||
let u64_ = self.u64_();
|
||||
let f32_ = self.f32_();
|
||||
let f64_ = self.f64_();
|
||||
let v8 = self.v8().map(|x| {
|
||||
x.into_iter().collect()
|
||||
});
|
||||
let vf64 = self.vf64().map(|x| {
|
||||
x.into_iter().collect()
|
||||
});
|
||||
TypeAliasesT {
|
||||
i8_,
|
||||
u8_,
|
||||
i16_,
|
||||
u16_,
|
||||
i32_,
|
||||
u32_,
|
||||
i64_,
|
||||
u64_,
|
||||
f32_,
|
||||
f64_,
|
||||
v8,
|
||||
vf64,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn i8_(&self) -> i8 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn u8_(&self) -> u8 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn i16_(&self) -> i16 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn u16_(&self) -> u16 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn i32_(&self) -> i32 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn u32_(&self) -> u32 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn i64_(&self) -> i64 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn u64_(&self) -> u64 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn f32_(&self) -> f32 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn f64_(&self) -> f64 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn v8(&self) -> Option<flatbuffers::Vector<'a, i8>> {
|
||||
// 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, i8>>>(TypeAliases::VT_V8, None)}
|
||||
}
|
||||
#[inline]
|
||||
pub fn vf64(&self) -> Option<flatbuffers::Vector<'a, f64>> {
|
||||
// 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, f64>>>(TypeAliases::VT_VF64, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TypeAliases<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<i8>("i8_", Self::VT_I8_, false)?
|
||||
.visit_field::<u8>("u8_", Self::VT_U8_, false)?
|
||||
.visit_field::<i16>("i16_", Self::VT_I16_, false)?
|
||||
.visit_field::<u16>("u16_", Self::VT_U16_, false)?
|
||||
.visit_field::<i32>("i32_", Self::VT_I32_, false)?
|
||||
.visit_field::<u32>("u32_", Self::VT_U32_, false)?
|
||||
.visit_field::<i64>("i64_", Self::VT_I64_, false)?
|
||||
.visit_field::<u64>("u64_", Self::VT_U64_, false)?
|
||||
.visit_field::<f32>("f32_", Self::VT_F32_, false)?
|
||||
.visit_field::<f64>("f64_", Self::VT_F64_, false)?
|
||||
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i8>>>("v8", Self::VT_V8, false)?
|
||||
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("vf64", Self::VT_VF64, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TypeAliasesArgs<'a> {
|
||||
pub i8_: i8,
|
||||
pub u8_: u8,
|
||||
pub i16_: i16,
|
||||
pub u16_: u16,
|
||||
pub i32_: i32,
|
||||
pub u32_: u32,
|
||||
pub i64_: i64,
|
||||
pub u64_: u64,
|
||||
pub f32_: f32,
|
||||
pub f64_: f64,
|
||||
pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i8>>>,
|
||||
pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
|
||||
}
|
||||
impl<'a> Default for TypeAliasesArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TypeAliasesArgs {
|
||||
i8_: 0,
|
||||
u8_: 0,
|
||||
i16_: 0,
|
||||
u16_: 0,
|
||||
i32_: 0,
|
||||
u32_: 0,
|
||||
i64_: 0,
|
||||
u64_: 0,
|
||||
f32_: 0.0,
|
||||
f64_: 0.0,
|
||||
v8: None,
|
||||
vf64: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TypeAliasesBuilder<'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> TypeAliasesBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_i8_(&mut self, i8_: i8) {
|
||||
self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_u8_(&mut self, u8_: u8) {
|
||||
self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_i16_(&mut self, i16_: i16) {
|
||||
self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_u16_(&mut self, u16_: u16) {
|
||||
self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_i32_(&mut self, i32_: i32) {
|
||||
self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_u32_(&mut self, u32_: u32) {
|
||||
self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_i64_(&mut self, i64_: i64) {
|
||||
self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_u64_(&mut self, u64_: u64) {
|
||||
self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_f32_(&mut self, f32_: f32) {
|
||||
self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_f64_(&mut self, f64_: f64) {
|
||||
self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_v8(&mut self, v8: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_vf64(&mut self, vf64: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TypeAliasesBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TypeAliases<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TypeAliases<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TypeAliases");
|
||||
ds.field("i8_", &self.i8_());
|
||||
ds.field("u8_", &self.u8_());
|
||||
ds.field("i16_", &self.i16_());
|
||||
ds.field("u16_", &self.u16_());
|
||||
ds.field("i32_", &self.i32_());
|
||||
ds.field("u32_", &self.u32_());
|
||||
ds.field("i64_", &self.i64_());
|
||||
ds.field("u64_", &self.u64_());
|
||||
ds.field("f32_", &self.f32_());
|
||||
ds.field("f64_", &self.f64_());
|
||||
ds.field("v8", &self.v8());
|
||||
ds.field("vf64", &self.vf64());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TypeAliasesT {
|
||||
pub i8_: i8,
|
||||
pub u8_: u8,
|
||||
pub i16_: i16,
|
||||
pub u16_: u16,
|
||||
pub i32_: i32,
|
||||
pub u32_: u32,
|
||||
pub i64_: i64,
|
||||
pub u64_: u64,
|
||||
pub f32_: f32,
|
||||
pub f64_: f64,
|
||||
pub v8: Option<Vec<i8>>,
|
||||
pub vf64: Option<Vec<f64>>,
|
||||
}
|
||||
impl Default for TypeAliasesT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
i8_: 0,
|
||||
u8_: 0,
|
||||
i16_: 0,
|
||||
u16_: 0,
|
||||
i32_: 0,
|
||||
u32_: 0,
|
||||
i64_: 0,
|
||||
u64_: 0,
|
||||
f32_: 0.0,
|
||||
f64_: 0.0,
|
||||
v8: None,
|
||||
vf64: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TypeAliasesT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TypeAliases<'b>> {
|
||||
let i8_ = self.i8_;
|
||||
let u8_ = self.u8_;
|
||||
let i16_ = self.i16_;
|
||||
let u16_ = self.u16_;
|
||||
let i32_ = self.i32_;
|
||||
let u32_ = self.u32_;
|
||||
let i64_ = self.i64_;
|
||||
let u64_ = self.u64_;
|
||||
let f32_ = self.f32_;
|
||||
let f64_ = self.f64_;
|
||||
let v8 = self.v8.as_ref().map(|x|{
|
||||
_fbb.create_vector(x)
|
||||
});
|
||||
let vf64 = self.vf64.as_ref().map(|x|{
|
||||
_fbb.create_vector(x)
|
||||
});
|
||||
TypeAliases::create(_fbb, &TypeAliasesArgs{
|
||||
i8_,
|
||||
u8_,
|
||||
i16_,
|
||||
u16_,
|
||||
i32_,
|
||||
u32_,
|
||||
i64_,
|
||||
u64_,
|
||||
f32_,
|
||||
f64_,
|
||||
v8,
|
||||
vf64,
|
||||
})
|
||||
}
|
||||
}
|
||||
+282
@@ -0,0 +1,282 @@
|
||||
// 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::*;
|
||||
// struct Vec3, aligned to 8
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct Vec3(pub [u8; 32]);
|
||||
impl Default for Vec3 {
|
||||
fn default() -> Self {
|
||||
Self([0; 32])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Vec3 {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("Vec3")
|
||||
.field("x", &self.x())
|
||||
.field("y", &self.y())
|
||||
.field("z", &self.z())
|
||||
.field("test1", &self.test1())
|
||||
.field("test2", &self.test2())
|
||||
.field("test3", &self.test3())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Vec3 {}
|
||||
impl<'a> flatbuffers::Follow<'a> for Vec3 {
|
||||
type Inner = &'a Vec3;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a Vec3>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a Vec3 {
|
||||
type Inner = &'a Vec3;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<Vec3>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for Vec3 {
|
||||
type Output = Vec3;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Vec3 {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Vec3 {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
x: f32,
|
||||
y: f32,
|
||||
z: f32,
|
||||
test1: f64,
|
||||
test2: Color,
|
||||
test3: &Test,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 32]);
|
||||
s.set_x(x);
|
||||
s.set_y(y);
|
||||
s.set_z(z);
|
||||
s.set_test1(test1);
|
||||
s.set_test2(test2);
|
||||
s.set_test3(test3);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example.Vec3"
|
||||
}
|
||||
|
||||
pub fn x(&self) -> f32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_x(&mut self, x: f32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn y(&self) -> f32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[4..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_y(&mut self, x: f32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[4..].as_mut_ptr(),
|
||||
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn z(&self) -> f32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[8..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_z(&mut self, x: f32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[8..].as_mut_ptr(),
|
||||
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test1(&self) -> f64 {
|
||||
let mut mem = core::mem::MaybeUninit::<<f64 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[16..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<f64 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_test1(&mut self, x: f64) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[16..].as_mut_ptr(),
|
||||
core::mem::size_of::<<f64 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test2(&self) -> Color {
|
||||
let mut mem = core::mem::MaybeUninit::<<Color as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[24..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<Color as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_test2(&mut self, x: Color) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[24..].as_mut_ptr(),
|
||||
core::mem::size_of::<<Color as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test3(&self) -> &Test {
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid struct in this slot
|
||||
unsafe { &*(self.0[26..].as_ptr() as *const Test) }
|
||||
}
|
||||
|
||||
#[allow(clippy::identity_op)]
|
||||
pub fn set_test3(&mut self, x: &Test) {
|
||||
self.0[26..26 + 4].copy_from_slice(&x.0)
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> Vec3T {
|
||||
Vec3T {
|
||||
x: self.x(),
|
||||
y: self.y(),
|
||||
z: self.z(),
|
||||
test1: self.test1(),
|
||||
test2: self.test2(),
|
||||
test3: self.test3().unpack(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct Vec3T {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
pub z: f32,
|
||||
pub test1: f64,
|
||||
pub test2: Color,
|
||||
pub test3: TestT,
|
||||
}
|
||||
impl Vec3T {
|
||||
pub fn pack(&self) -> Vec3 {
|
||||
Vec3::new(
|
||||
self.x,
|
||||
self.y,
|
||||
self.z,
|
||||
self.test1,
|
||||
self.test2,
|
||||
&self.test3.pack(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
// 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 MonsterOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct Monster<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
|
||||
type Inner = Monster<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Monster<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.Example2.Monster"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
Monster { _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 MonsterArgs
|
||||
) -> flatbuffers::WIPOffset<Monster<'bldr>> {
|
||||
let mut builder = MonsterBuilder::new(_fbb);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> MonsterT {
|
||||
MonsterT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for Monster<'_> {
|
||||
#[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 MonsterArgs {
|
||||
}
|
||||
impl<'a> Default for MonsterArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
MonsterArgs {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MonsterBuilder<'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> MonsterBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
MonsterBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Monster<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Monster");
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct MonsterT {
|
||||
}
|
||||
impl Default for MonsterT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl MonsterT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<Monster<'b>> {
|
||||
Monster::create(_fbb, &MonsterArgs{
|
||||
})
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
// 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 InParentNamespaceOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct InParentNamespace<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> {
|
||||
type Inner = InParentNamespace<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> InParentNamespace<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.InParentNamespace"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
InParentNamespace { _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 InParentNamespaceArgs
|
||||
) -> flatbuffers::WIPOffset<InParentNamespace<'bldr>> {
|
||||
let mut builder = InParentNamespaceBuilder::new(_fbb);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> InParentNamespaceT {
|
||||
InParentNamespaceT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for InParentNamespace<'_> {
|
||||
#[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 InParentNamespaceArgs {
|
||||
}
|
||||
impl<'a> Default for InParentNamespaceArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
InParentNamespaceArgs {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InParentNamespaceBuilder<'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> InParentNamespaceBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
InParentNamespaceBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<InParentNamespace<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for InParentNamespace<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("InParentNamespace");
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct InParentNamespaceT {
|
||||
}
|
||||
impl Default for InParentNamespaceT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl InParentNamespaceT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<InParentNamespace<'b>> {
|
||||
InParentNamespace::create(_fbb, &InParentNamespaceArgs{
|
||||
})
|
||||
}
|
||||
}
|
||||
Vendored
+92
@@ -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_FROM_INCLUDE: i64 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_FROM_INCLUDE: i64 = 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_FROM_INCLUDE: [FromInclude; 1] = [
|
||||
FromInclude::IncludeVal,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct FromInclude(pub i64);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl FromInclude {
|
||||
pub const IncludeVal: Self = Self(0);
|
||||
|
||||
pub const ENUM_MIN: i64 = 0;
|
||||
pub const ENUM_MAX: i64 = 0;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::IncludeVal,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::IncludeVal => Some("IncludeVal"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for FromInclude {
|
||||
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 FromInclude {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<i64>(buf, loc);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for FromInclude {
|
||||
type Output = FromInclude;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<i64>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for FromInclude {
|
||||
type Scalar = i64;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i64 {
|
||||
self.0.to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: i64) -> Self {
|
||||
let b = i64::from_le(v);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for FromInclude {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
i64::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for FromInclude {}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// 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 TableBOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableB<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
|
||||
type Inner = TableB<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableB<'a> {
|
||||
pub const VT_A: flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.OtherNameSpace.TableB"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TableB { _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 TableBArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<TableB<'bldr>> {
|
||||
let mut builder = TableBBuilder::new(_fbb);
|
||||
if let Some(x) = args.a { builder.add_a(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableBT {
|
||||
let a = self.a().map(|x| {
|
||||
Box::new(x.unpack())
|
||||
});
|
||||
TableBT {
|
||||
a,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn a(&self) -> Option<super::super::TableA<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TableB<'_> {
|
||||
#[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<super::super::TableA>>("a", Self::VT_A, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableBArgs<'a> {
|
||||
pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableBArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableBArgs {
|
||||
a: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableBBuilder<'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> TableBBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableBBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableB<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TableB<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableB");
|
||||
ds.field("a", &self.a());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableBT {
|
||||
pub a: Option<Box<super::super::TableAT>>,
|
||||
}
|
||||
impl Default for TableBT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
a: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableBT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TableB<'b>> {
|
||||
let a = self.a.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableB::create(_fbb, &TableBArgs{
|
||||
a,
|
||||
})
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
// 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::*;
|
||||
// struct Unused, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct Unused(pub [u8; 4]);
|
||||
impl Default for Unused {
|
||||
fn default() -> Self {
|
||||
Self([0; 4])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Unused {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("Unused")
|
||||
.field("a", &self.a())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Unused {}
|
||||
impl<'a> flatbuffers::Follow<'a> for Unused {
|
||||
type Inner = &'a Unused;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a Unused>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a Unused {
|
||||
type Inner = &'a Unused;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<Unused>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for Unused {
|
||||
type Output = Unused;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Unused {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Unused {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: i32,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 4]);
|
||||
s.set_a(a);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.OtherNameSpace.Unused"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> i32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_a(&mut self, x: i32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> UnusedT {
|
||||
UnusedT {
|
||||
a: self.a(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct UnusedT {
|
||||
pub a: i32,
|
||||
}
|
||||
impl UnusedT {
|
||||
pub fn pack(&self) -> Unused {
|
||||
Unused::new(
|
||||
self.a,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
// 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 TableAOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableA<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableA<'a> {
|
||||
type Inner = TableA<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableA<'a> {
|
||||
pub const VT_B: flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"TableA"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TableA { _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 TableAArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<TableA<'bldr>> {
|
||||
let mut builder = TableABuilder::new(_fbb);
|
||||
if let Some(x) = args.b { builder.add_b(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableAT {
|
||||
let b = self.b().map(|x| {
|
||||
Box::new(x.unpack())
|
||||
});
|
||||
TableAT {
|
||||
b,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn b(&self) -> Option<my_game::other_name_space::TableB<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TableA<'_> {
|
||||
#[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<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableAArgs<'a> {
|
||||
pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableAArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableAArgs {
|
||||
b: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableABuilder<'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> TableABuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableABuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TableA<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableA");
|
||||
ds.field("b", &self.b());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableAT {
|
||||
pub b: Option<Box<my_game::other_name_space::TableBT>>,
|
||||
}
|
||||
impl Default for TableAT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
b: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableAT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TableA<'b>> {
|
||||
let b = self.b.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableA::create(_fbb, &TableAArgs{
|
||||
b,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user