Generate better formatted Rust code (#8919)

* Cleans up Rust formatting

* Regenerates generated schemas
This commit is contained in:
Cameron Mulhern
2026-03-04 21:49:46 -05:00
committed by GitHub
parent 9c383559e0
commit 08b6372a36
95 changed files with 2783 additions and 1062 deletions

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
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")
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for Ability {
}
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 {
unsafe { <&'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 {
unsafe { ::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 = unsafe { ::core::slice::from_raw_parts(self as *const Ability as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
@@ -102,6 +112,7 @@ impl<'a> Ability {
}
}
#[inline]
pub fn key_compare_less_than(&self, o: &Ability) -> bool {
self.id() < o.id()
@@ -154,6 +165,7 @@ pub struct AbilityT {
pub id: u32,
pub distance: u32,
}
impl AbilityT {
pub fn pack(&self) -> Ability {
Ability::new(
@@ -162,4 +174,3 @@ impl AbilityT {
)
}
}

View File

@@ -2,10 +2,13 @@
// @generated
extern crate alloc;
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] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
#[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);
@@ -33,6 +37,7 @@ impl AnyAmbiguousAliases {
Self::M2,
Self::M3,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
@@ -44,6 +49,7 @@ impl AnyAmbiguousAliases {
}
}
}
impl ::core::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for AnyAmbiguousAliases {
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
impl ::flatbuffers::Push for AnyAmbiguousAliases {
type Output = AnyAmbiguousAliases;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for AnyAmbiguousAliases {
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 {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyAmbiguousAliases {
}
impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum AnyAmbiguousAliasesT {
M2(alloc::boxed::Box<MonsterT>),
M3(alloc::boxed::Box<MonsterT>),
}
impl Default for AnyAmbiguousAliasesT {
fn default() -> Self {
Self::NONE
}
}
impl AnyAmbiguousAliasesT {
pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases {
match self {
@@ -119,6 +133,7 @@ impl AnyAmbiguousAliasesT {
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,
@@ -127,6 +142,7 @@ impl AnyAmbiguousAliasesT {
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<alloc::boxed::Box<MonsterT>> {
if let Self::M1(_) = self {
@@ -140,14 +156,17 @@ impl AnyAmbiguousAliasesT {
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<alloc::boxed::Box<MonsterT>> {
if let Self::M2(_) = self {
@@ -161,14 +180,17 @@ impl AnyAmbiguousAliasesT {
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<alloc::boxed::Box<MonsterT>> {
if let Self::M3(_) = self {
@@ -182,12 +204,15 @@ impl AnyAmbiguousAliasesT {
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 }
}
}

View File

@@ -2,10 +2,13 @@
// @generated
extern crate alloc;
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] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_ANY: [Any; 4] = [
#[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);
@@ -33,6 +37,7 @@ impl Any {
Self::TestSimpleTableWithEnum,
Self::MyGame_Example2_Monster,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
@@ -44,6 +49,7 @@ impl Any {
}
}
}
impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for Any {
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Any {
impl ::flatbuffers::Push for Any {
type Output = Any;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for Any {
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 {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for Any {
}
impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum AnyT {
TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>),
MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>),
}
impl Default for AnyT {
fn default() -> Self {
Self::NONE
}
}
impl AnyT {
pub fn any_type(&self) -> Any {
match self {
@@ -119,6 +133,7 @@ impl AnyT {
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,
@@ -127,6 +142,7 @@ impl AnyT {
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<alloc::boxed::Box<MonsterT>> {
if let Self::Monster(_) = self {
@@ -140,14 +156,17 @@ impl AnyT {
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<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self {
@@ -161,14 +180,17 @@ impl AnyT {
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<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self {
@@ -182,12 +204,15 @@ impl AnyT {
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 }
}
}

View File

@@ -2,10 +2,13 @@
// @generated
extern crate alloc;
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] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
#[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);
@@ -33,6 +37,7 @@ impl AnyUniqueAliases {
Self::TS,
Self::M2,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
@@ -44,6 +49,7 @@ impl AnyUniqueAliases {
}
}
}
impl ::core::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for AnyUniqueAliases {
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
impl ::flatbuffers::Push for AnyUniqueAliases {
type Output = AnyUniqueAliases;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for AnyUniqueAliases {
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 {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyUniqueAliases {
}
impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
pub struct AnyUniqueAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum AnyUniqueAliasesT {
TS(alloc::boxed::Box<TestSimpleTableWithEnumT>),
M2(alloc::boxed::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 {
@@ -119,6 +133,7 @@ impl AnyUniqueAliasesT {
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,
@@ -127,6 +142,7 @@ impl AnyUniqueAliasesT {
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<alloc::boxed::Box<MonsterT>> {
if let Self::M(_) = self {
@@ -140,14 +156,17 @@ impl AnyUniqueAliasesT {
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<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self {
@@ -161,14 +180,17 @@ impl AnyUniqueAliasesT {
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<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self {
@@ -182,12 +204,15 @@ impl AnyUniqueAliasesT {
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 }
}
}

View File

@@ -2,6 +2,7 @@
// @generated
extern crate alloc;
use super::*;
#[allow(non_upper_case_globals)]
mod bitflags_color {
::flatbuffers::bitflags::bitflags! {
@@ -17,10 +18,12 @@ mod bitflags_color {
}
}
}
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 = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -30,6 +33,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Color {
impl ::flatbuffers::Push for Color {
type Output = Color;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
@@ -38,10 +42,12 @@ impl ::flatbuffers::Push for Color {
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 {

View File

@@ -2,6 +2,7 @@
// @generated
extern crate alloc;
use super::*;
#[allow(non_upper_case_globals)]
mod bitflags_long_enum {
::flatbuffers::bitflags::bitflags! {
@@ -13,10 +14,12 @@ mod bitflags_long_enum {
}
}
}
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 = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) };
@@ -26,6 +29,7 @@ impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
@@ -34,10 +38,12 @@ impl ::flatbuffers::Push for LongEnum {
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 {

View File

@@ -2,16 +2,18 @@
// @generated
extern crate alloc;
use super::*;
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
/// an example documentation comment: "monster object"
#[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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -89,6 +91,7 @@ impl<'a> Monster<'a> {
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>,
@@ -394,6 +397,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<Vec3>(Monster::VT_POS, None)}
}
#[inline]
pub fn mana(&self) -> i16 {
// Safety:
@@ -401,6 +405,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()}
}
#[inline]
pub fn hp(&self) -> i16 {
// Safety:
@@ -408,6 +413,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()}
}
#[inline]
pub fn name(&self) -> &'a str {
// Safety:
@@ -415,6 +421,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()}
}
#[inline]
pub fn key_compare_less_than(&self, o: &Monster) -> bool {
self.name() < o.name()
@@ -425,6 +432,7 @@ impl<'a> Monster<'a> {
let key = self.name();
key.cmp(val)
}
#[inline]
pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety:
@@ -432,6 +440,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)}
}
#[inline]
pub fn color(&self) -> Color {
// Safety:
@@ -439,6 +448,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()}
}
#[inline]
pub fn test_type(&self) -> Any {
// Safety:
@@ -446,6 +456,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<Any>(Monster::VT_TEST_TYPE, Some(Any::NONE)).unwrap()}
}
#[inline]
pub fn test(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety:
@@ -453,6 +464,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_TEST, None)}
}
#[inline]
pub fn test4(&self) -> Option<::flatbuffers::Vector<'a, Test>> {
// Safety:
@@ -460,6 +472,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST4, None)}
}
#[inline]
pub fn testarrayofstring(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> {
// Safety:
@@ -467,6 +480,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING, None)}
}
/// an example documentation comment: this will end up in the generated code
/// multiline too
#[inline]
@@ -476,6 +490,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Monster>>>>(Monster::VT_TESTARRAYOFTABLES, None)}
}
#[inline]
pub fn enemy(&self) -> Option<Monster<'a>> {
// Safety:
@@ -483,6 +498,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<Monster>>(Monster::VT_ENEMY, None)}
}
#[inline]
pub fn testnestedflatbuffer(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety:
@@ -490,6 +506,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None)}
}
pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
self.testnestedflatbuffer().map(|data| {
use ::flatbuffers::Follow;
@@ -499,6 +516,7 @@ impl<'a> Monster<'a> {
unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) }
})
}
#[inline]
pub fn testempty(&self) -> Option<Stat<'a>> {
// Safety:
@@ -506,6 +524,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<Stat>>(Monster::VT_TESTEMPTY, None)}
}
#[inline]
pub fn testbool(&self) -> bool {
// Safety:
@@ -513,6 +532,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<bool>(Monster::VT_TESTBOOL, Some(false)).unwrap()}
}
#[inline]
pub fn testhashs32_fnv1(&self) -> i32 {
// Safety:
@@ -520,6 +540,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1, Some(0)).unwrap()}
}
#[inline]
pub fn testhashu32_fnv1(&self) -> u32 {
// Safety:
@@ -527,6 +548,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1, Some(0)).unwrap()}
}
#[inline]
pub fn testhashs64_fnv1(&self) -> i64 {
// Safety:
@@ -534,6 +556,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1, Some(0)).unwrap()}
}
#[inline]
pub fn testhashu64_fnv1(&self) -> u64 {
// Safety:
@@ -541,6 +564,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1, Some(0)).unwrap()}
}
#[inline]
pub fn testhashs32_fnv1a(&self) -> i32 {
// Safety:
@@ -548,6 +572,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1A, Some(0)).unwrap()}
}
#[inline]
pub fn testhashu32_fnv1a(&self) -> u32 {
// Safety:
@@ -555,6 +580,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1A, Some(0)).unwrap()}
}
#[inline]
pub fn testhashs64_fnv1a(&self) -> i64 {
// Safety:
@@ -562,6 +588,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1A, Some(0)).unwrap()}
}
#[inline]
pub fn testhashu64_fnv1a(&self) -> u64 {
// Safety:
@@ -569,6 +596,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1A, Some(0)).unwrap()}
}
#[inline]
pub fn testarrayofbools(&self) -> Option<::flatbuffers::Vector<'a, bool>> {
// Safety:
@@ -576,6 +604,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, bool>>>(Monster::VT_TESTARRAYOFBOOLS, None)}
}
#[inline]
pub fn testf(&self) -> f32 {
// Safety:
@@ -583,6 +612,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_TESTF, Some(3.14159)).unwrap()}
}
#[inline]
pub fn testf2(&self) -> f32 {
// Safety:
@@ -590,6 +620,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_TESTF2, Some(3.0)).unwrap()}
}
#[inline]
pub fn testf3(&self) -> f32 {
// Safety:
@@ -597,6 +628,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_TESTF3, Some(0.0)).unwrap()}
}
#[inline]
pub fn testarrayofstring2(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> {
// Safety:
@@ -604,6 +636,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING2, None)}
}
#[inline]
pub fn testarrayofsortedstruct(&self) -> Option<::flatbuffers::Vector<'a, Ability>> {
// Safety:
@@ -611,6 +644,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Ability>>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, None)}
}
#[inline]
pub fn flex(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety:
@@ -618,6 +652,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_FLEX, None)}
}
#[inline]
pub fn test5(&self) -> Option<::flatbuffers::Vector<'a, Test>> {
// Safety:
@@ -625,6 +660,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST5, None)}
}
#[inline]
pub fn vector_of_longs(&self) -> Option<::flatbuffers::Vector<'a, i64>> {
// Safety:
@@ -632,6 +668,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i64>>>(Monster::VT_VECTOR_OF_LONGS, None)}
}
#[inline]
pub fn vector_of_doubles(&self) -> Option<::flatbuffers::Vector<'a, f64>> {
// Safety:
@@ -639,6 +676,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f64>>>(Monster::VT_VECTOR_OF_DOUBLES, None)}
}
#[inline]
pub fn parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>> {
// Safety:
@@ -646,6 +684,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, None)}
}
#[inline]
pub fn vector_of_referrables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
// Safety:
@@ -653,6 +692,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None)}
}
#[inline]
pub fn single_weak_reference(&self) -> u64 {
// Safety:
@@ -660,6 +700,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, Some(0)).unwrap()}
}
#[inline]
pub fn vector_of_weak_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
// Safety:
@@ -667,6 +708,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None)}
}
#[inline]
pub fn vector_of_strong_referrables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
// Safety:
@@ -674,6 +716,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None)}
}
#[inline]
pub fn co_owning_reference(&self) -> u64 {
// Safety:
@@ -681,6 +724,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_CO_OWNING_REFERENCE, Some(0)).unwrap()}
}
#[inline]
pub fn vector_of_co_owning_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
// Safety:
@@ -688,6 +732,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, None)}
}
#[inline]
pub fn non_owning_reference(&self) -> u64 {
// Safety:
@@ -695,6 +740,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_NON_OWNING_REFERENCE, Some(0)).unwrap()}
}
#[inline]
pub fn vector_of_non_owning_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
// Safety:
@@ -702,6 +748,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)}
}
#[inline]
pub fn any_unique_type(&self) -> AnyUniqueAliases {
// Safety:
@@ -709,6 +756,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()}
}
#[inline]
pub fn any_unique(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety:
@@ -716,6 +764,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)}
}
#[inline]
pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases {
// Safety:
@@ -723,6 +772,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()}
}
#[inline]
pub fn any_ambiguous(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety:
@@ -730,6 +780,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)}
}
#[inline]
pub fn vector_of_enums(&self) -> Option<::flatbuffers::Vector<'a, Color>> {
// Safety:
@@ -737,6 +788,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)}
}
#[inline]
pub fn signed_enum(&self) -> Race {
// Safety:
@@ -744,6 +796,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<Race>(Monster::VT_SIGNED_ENUM, Some(Race::None)).unwrap()}
}
#[inline]
pub fn testrequirednestedflatbuffer(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety:
@@ -751,6 +804,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, None)}
}
pub fn testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
self.testrequirednestedflatbuffer().map(|data| {
use ::flatbuffers::Follow;
@@ -760,6 +814,7 @@ impl<'a> Monster<'a> {
unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) }
})
}
#[inline]
pub fn scalar_key_sorted_tables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Stat<'a>>>> {
// Safety:
@@ -767,6 +822,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Stat>>>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, None)}
}
#[inline]
pub fn native_inline(&self) -> Option<&'a Test> {
// Safety:
@@ -774,6 +830,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<Test>(Monster::VT_NATIVE_INLINE, None)}
}
#[inline]
pub fn long_enum_non_enum_default(&self) -> LongEnum {
// Safety:
@@ -781,6 +838,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, Some(Default::default())).unwrap()}
}
#[inline]
pub fn long_enum_normal_default(&self) -> LongEnum {
// Safety:
@@ -788,6 +846,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, Some(LongEnum::LongOne)).unwrap()}
}
#[inline]
pub fn nan_default(&self) -> f32 {
// Safety:
@@ -795,6 +854,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_NAN_DEFAULT, Some(f32::NAN)).unwrap()}
}
#[inline]
pub fn inf_default(&self) -> f32 {
// Safety:
@@ -802,6 +862,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_INF_DEFAULT, Some(f32::INFINITY)).unwrap()}
}
#[inline]
pub fn positive_inf_default(&self) -> f32 {
// Safety:
@@ -809,6 +870,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_POSITIVE_INF_DEFAULT, Some(f32::INFINITY)).unwrap()}
}
#[inline]
pub fn infinity_default(&self) -> f32 {
// Safety:
@@ -816,6 +878,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_INFINITY_DEFAULT, Some(f32::INFINITY)).unwrap()}
}
#[inline]
pub fn positive_infinity_default(&self) -> f32 {
// Safety:
@@ -823,6 +886,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_POSITIVE_INFINITY_DEFAULT, Some(f32::INFINITY)).unwrap()}
}
#[inline]
pub fn negative_inf_default(&self) -> f32 {
// Safety:
@@ -830,6 +894,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_NEGATIVE_INF_DEFAULT, Some(f32::NEG_INFINITY)).unwrap()}
}
#[inline]
pub fn negative_infinity_default(&self) -> f32 {
// Safety:
@@ -837,6 +902,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_NEGATIVE_INFINITY_DEFAULT, Some(f32::NEG_INFINITY)).unwrap()}
}
#[inline]
pub fn double_inf_default(&self) -> f64 {
// Safety:
@@ -844,6 +910,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<f64>(Monster::VT_DOUBLE_INF_DEFAULT, Some(f64::INFINITY)).unwrap()}
}
#[inline]
#[allow(non_snake_case)]
pub fn test_as_monster(&self) -> Option<Monster<'a>> {
@@ -978,7 +1045,6 @@ impl<'a> Monster<'a> {
None
}
}
}
impl ::flatbuffers::Verifiable for Monster<'_> {
@@ -1070,6 +1136,7 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
Ok(())
}
}
pub struct MonsterArgs<'a> {
pub pos: Option<&'a Vec3>,
pub mana: i16,
@@ -1133,6 +1200,7 @@ pub struct MonsterArgs<'a> {
pub negative_infinity_default: f32,
pub double_inf_default: f64,
}
impl<'a> Default for MonsterArgs<'a> {
#[inline]
fn default() -> Self {
@@ -1206,251 +1274,313 @@ 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 add_pos(&mut self, pos: &Vec3) {
self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
}
#[inline]
pub fn add_mana(&mut self, mana: i16) {
self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150);
}
#[inline]
pub fn add_hp(&mut self, hp: i16) {
self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
}
#[inline]
pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
}
#[inline]
pub fn add_inventory(&mut self, inventory: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
}
#[inline]
pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
}
#[inline]
pub fn add_test_type(&mut self, test_type: Any) {
self.fbb_.push_slot::<Any>(Monster::VT_TEST_TYPE, test_type, Any::NONE);
}
#[inline]
pub fn add_test(&mut self, test: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST, test);
}
#[inline]
pub fn add_test4(&mut self, test4: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Test>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST4, test4);
}
#[inline]
pub fn add_testarrayofstring(&mut self, testarrayofstring: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b str>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
}
#[inline]
pub fn add_testarrayoftables(&mut self, testarrayoftables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Monster<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
}
#[inline]
pub fn add_enemy(&mut self, enemy: ::flatbuffers::WIPOffset<Monster<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<Monster>>(Monster::VT_ENEMY, enemy);
}
#[inline]
pub fn add_testnestedflatbuffer(&mut self, testnestedflatbuffer: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
}
#[inline]
pub fn add_testempty(&mut self, testempty: ::flatbuffers::WIPOffset<Stat<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<Stat>>(Monster::VT_TESTEMPTY, testempty);
}
#[inline]
pub fn add_testbool(&mut self, testbool: bool) {
self.fbb_.push_slot::<bool>(Monster::VT_TESTBOOL, testbool, false);
}
#[inline]
pub fn add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32) {
self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
}
#[inline]
pub fn add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32) {
self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
}
#[inline]
pub fn add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64) {
self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
}
#[inline]
pub fn add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
}
#[inline]
pub fn add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32) {
self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
}
#[inline]
pub fn add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32) {
self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
}
#[inline]
pub fn add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64) {
self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
}
#[inline]
pub fn add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
}
#[inline]
pub fn add_testarrayofbools(&mut self, testarrayofbools: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , bool>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
}
#[inline]
pub fn add_testf(&mut self, testf: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_TESTF, testf, 3.14159);
}
#[inline]
pub fn add_testf2(&mut self, testf2: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_TESTF2, testf2, 3.0);
}
#[inline]
pub fn add_testf3(&mut self, testf3: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_TESTF3, testf3, 0.0);
}
#[inline]
pub fn add_testarrayofstring2(&mut self, testarrayofstring2: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b str>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
}
#[inline]
pub fn add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Ability>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
}
#[inline]
pub fn add_flex(&mut self, flex: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_FLEX, flex);
}
#[inline]
pub fn add_test5(&mut self, test5: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Test>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST5, test5);
}
#[inline]
pub fn add_vector_of_longs(&mut self, vector_of_longs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
}
#[inline]
pub fn add_vector_of_doubles(&mut self, vector_of_doubles: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
}
#[inline]
pub fn add_parent_namespace_test(&mut self, parent_namespace_test: ::flatbuffers::WIPOffset<super::InParentNamespace<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
}
#[inline]
pub fn add_vector_of_referrables(&mut self, vector_of_referrables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
}
#[inline]
pub fn add_single_weak_reference(&mut self, single_weak_reference: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
}
#[inline]
pub fn add_vector_of_weak_references(&mut self, vector_of_weak_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
}
#[inline]
pub fn add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
}
#[inline]
pub fn add_co_owning_reference(&mut self, co_owning_reference: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
}
#[inline]
pub fn add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
}
#[inline]
pub fn add_non_owning_reference(&mut self, non_owning_reference: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
}
#[inline]
pub fn add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
}
#[inline]
pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) {
self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE);
}
#[inline]
pub fn add_any_unique(&mut self, any_unique: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique);
}
#[inline]
pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) {
self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE);
}
#[inline]
pub fn add_any_ambiguous(&mut self, any_ambiguous: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
}
#[inline]
pub fn add_vector_of_enums(&mut self, vector_of_enums: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Color>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
}
#[inline]
pub fn add_signed_enum(&mut self, signed_enum: Race) {
self.fbb_.push_slot::<Race>(Monster::VT_SIGNED_ENUM, signed_enum, Race::None);
}
#[inline]
pub fn add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
}
#[inline]
pub fn add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Stat<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
}
#[inline]
pub fn add_native_inline(&mut self, native_inline: &Test) {
self.fbb_.push_slot_always::<&Test>(Monster::VT_NATIVE_INLINE, native_inline);
}
#[inline]
pub fn add_long_enum_non_enum_default(&mut self, long_enum_non_enum_default: LongEnum) {
self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, long_enum_non_enum_default, Default::default());
}
#[inline]
pub fn add_long_enum_normal_default(&mut self, long_enum_normal_default: LongEnum) {
self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, long_enum_normal_default, LongEnum::LongOne);
}
#[inline]
pub fn add_nan_default(&mut self, nan_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_NAN_DEFAULT, nan_default, f32::NAN);
}
#[inline]
pub fn add_inf_default(&mut self, inf_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_INF_DEFAULT, inf_default, f32::INFINITY);
}
#[inline]
pub fn add_positive_inf_default(&mut self, positive_inf_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_POSITIVE_INF_DEFAULT, positive_inf_default, f32::INFINITY);
}
#[inline]
pub fn add_infinity_default(&mut self, infinity_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_INFINITY_DEFAULT, infinity_default, f32::INFINITY);
}
#[inline]
pub fn add_positive_infinity_default(&mut self, positive_infinity_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_POSITIVE_INFINITY_DEFAULT, positive_infinity_default, f32::INFINITY);
}
#[inline]
pub fn add_negative_inf_default(&mut self, negative_inf_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_NEGATIVE_INF_DEFAULT, negative_inf_default, f32::NEG_INFINITY);
}
#[inline]
pub fn add_negative_infinity_default(&mut self, negative_infinity_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_NEGATIVE_INFINITY_DEFAULT, negative_infinity_default, f32::NEG_INFINITY);
}
#[inline]
pub fn add_double_inf_default(&mut self, double_inf_default: f64) {
self.fbb_.push_slot::<f64>(Monster::VT_DOUBLE_INF_DEFAULT, double_inf_default, f64::INFINITY);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
let start = _fbb.start_table();
@@ -1459,6 +1589,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -1612,6 +1743,7 @@ impl ::core::fmt::Debug for Monster<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct MonsterT {
@@ -1674,6 +1806,7 @@ pub struct MonsterT {
pub negative_infinity_default: f32,
pub double_inf_default: f64,
}
impl Default for MonsterT {
fn default() -> Self {
Self {
@@ -1738,6 +1871,7 @@ impl Default for MonsterT {
}
}
}
impl MonsterT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
@@ -1920,66 +2054,73 @@ impl MonsterT {
})
}
}
#[inline]
/// Verifies that a buffer of bytes contains a `Monster`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_monster_unchecked`.
#[inline]
pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<Monster>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `Monster` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_monster_unchecked`.
#[inline]
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<Monster>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `Monster` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_monster_unchecked`.
#[inline]
pub fn root_as_monster_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<Monster<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Monster` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_monster_unchecked`.
#[inline]
pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Monster`.
#[inline]
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { ::flatbuffers::root_unchecked::<Monster>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
#[inline]
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) }
}
pub const MONSTER_IDENTIFIER: &str = "MONS";
#[inline]

View File

@@ -2,10 +2,13 @@
// @generated
extern crate alloc;
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] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_RACE: [Race; 4] = [
#[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);
@@ -33,6 +37,7 @@ impl Race {
Self::Dwarf,
Self::Elf,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
@@ -44,6 +49,7 @@ impl Race {
}
}
}
impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for Race {
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for Race {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Race {
impl ::flatbuffers::Push for Race {
type Output = Race;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for Race {
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 {

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> Referrable<'a> {
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>,
@@ -52,6 +55,7 @@ impl<'a> Referrable<'a> {
// 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()
@@ -75,9 +79,11 @@ impl ::flatbuffers::Verifiable for Referrable<'_> {
Ok(())
}
}
pub struct ReferrableArgs {
pub id: u64,
}
impl<'a> Default for ReferrableArgs {
#[inline]
fn default() -> Self {
@@ -91,11 +97,13 @@ 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();
@@ -104,6 +112,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A>
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -118,11 +127,13 @@ impl ::core::fmt::Debug for Referrable<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct ReferrableT {
pub id: u64,
}
impl Default for ReferrableT {
fn default() -> Self {
Self {
@@ -130,6 +141,7 @@ impl Default for ReferrableT {
}
}
}
impl ReferrableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -30,6 +32,7 @@ impl<'a> Stat<'a> {
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>,
@@ -62,6 +65,7 @@ impl<'a> Stat<'a> {
// 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:
@@ -69,6 +73,7 @@ impl<'a> Stat<'a> {
// 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:
@@ -76,6 +81,7 @@ impl<'a> Stat<'a> {
// 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()
@@ -101,11 +107,13 @@ impl ::flatbuffers::Verifiable for Stat<'_> {
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 {
@@ -121,19 +129,23 @@ 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();
@@ -142,6 +154,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -158,6 +171,7 @@ impl ::core::fmt::Debug for Stat<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct StatT {
@@ -165,6 +179,7 @@ pub struct StatT {
pub val: i64,
pub count: u16,
}
impl Default for StatT {
fn default() -> Self {
Self {
@@ -174,6 +189,7 @@ impl Default for StatT {
}
}
}
impl StatT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
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")
@@ -22,27 +25,34 @@ impl ::core::fmt::Debug for StructOfStructs {
}
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 {
unsafe { <&'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 {
unsafe { ::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 = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
@@ -127,6 +137,7 @@ pub struct StructOfStructsT {
pub b: TestT,
pub c: AbilityT,
}
impl StructOfStructsT {
pub fn pack(&self) -> StructOfStructs {
StructOfStructs::new(
@@ -136,4 +147,3 @@ impl StructOfStructsT {
)
}
}

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
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")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for StructOfStructsOfStructs {
}
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 {
unsafe { <&'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 {
unsafe { ::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 = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
@@ -93,6 +103,7 @@ impl<'a> StructOfStructsOfStructs {
pub struct StructOfStructsOfStructsT {
pub a: StructOfStructsT,
}
impl StructOfStructsOfStructsT {
pub fn pack(&self) -> StructOfStructsOfStructs {
StructOfStructsOfStructs::new(
@@ -100,4 +111,3 @@ impl StructOfStructsOfStructsT {
)
}
}

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
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")
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for Test {
}
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 {
unsafe { <&'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 {
unsafe { ::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 = unsafe { ::core::slice::from_raw_parts(self as *const Test as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(2)
@@ -144,6 +154,7 @@ pub struct TestT {
pub a: i16,
pub b: i8,
}
impl TestT {
pub fn pack(&self) -> Test {
Test::new(
@@ -152,4 +163,3 @@ impl TestT {
)
}
}

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TestSimpleTableWithEnum<'a> {
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>,
@@ -65,9 +68,11 @@ impl ::flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
Ok(())
}
}
pub struct TestSimpleTableWithEnumArgs {
pub color: Color,
}
impl<'a> Default for TestSimpleTableWithEnumArgs {
#[inline]
fn default() -> Self {
@@ -81,11 +86,13 @@ pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocato
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();
@@ -94,6 +101,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilde
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -108,11 +116,13 @@ impl ::core::fmt::Debug for TestSimpleTableWithEnum<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TestSimpleTableWithEnumT {
pub color: Color,
}
impl Default for TestSimpleTableWithEnumT {
fn default() -> Self {
Self {
@@ -120,6 +130,7 @@ impl Default for TestSimpleTableWithEnumT {
}
}
}
impl TestSimpleTableWithEnumT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -39,6 +41,7 @@ impl<'a> TypeAliases<'a> {
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>,
@@ -100,6 +103,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -107,6 +111,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -114,6 +119,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -121,6 +127,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -128,6 +135,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -135,6 +143,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -142,6 +151,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -149,6 +159,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -156,6 +167,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -163,6 +175,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -170,6 +183,7 @@ impl<'a> TypeAliases<'a> {
// 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:
@@ -201,6 +215,7 @@ impl ::flatbuffers::Verifiable for TypeAliases<'_> {
Ok(())
}
}
pub struct TypeAliasesArgs<'a> {
pub i8_: i8,
pub u8_: u8,
@@ -215,6 +230,7 @@ pub struct TypeAliasesArgs<'a> {
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 {
@@ -239,55 +255,68 @@ 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();
@@ -296,6 +325,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A>
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -321,6 +351,7 @@ impl ::core::fmt::Debug for TypeAliases<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TypeAliasesT {
@@ -337,6 +368,7 @@ pub struct TypeAliasesT {
pub v8: Option<alloc::vec::Vec<i8>>,
pub vf64: Option<alloc::vec::Vec<f64>>,
}
impl Default for TypeAliasesT {
fn default() -> Self {
Self {
@@ -355,6 +387,7 @@ impl Default for TypeAliasesT {
}
}
}
impl TypeAliasesT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
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")
@@ -25,27 +28,34 @@ impl ::core::fmt::Debug for Vec3 {
}
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 {
unsafe { <&'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 {
unsafe { ::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 = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8)
@@ -263,6 +273,7 @@ pub struct Vec3T {
pub test2: Color,
pub test3: TestT,
}
impl Vec3T {
pub fn pack(&self) -> Vec3 {
Vec3::new(
@@ -275,4 +286,3 @@ impl Vec3T {
)
}
}

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
}
impl<'a> Monster<'a> {
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example2.Monster"
}
@@ -27,6 +28,7 @@ impl<'a> Monster<'a> {
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>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
Ok(())
}
}
pub struct MonsterArgs {
}
impl<'a> Default for MonsterArgs {
#[inline]
fn default() -> Self {
@@ -66,6 +70,7 @@ 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> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for 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,

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
}
impl<'a> InParentNamespace<'a> {
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.InParentNamespace"
}
@@ -27,6 +28,7 @@ impl<'a> InParentNamespace<'a> {
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>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for InParentNamespace<'_> {
Ok(())
}
}
pub struct InParentNamespaceArgs {
}
impl<'a> Default for InParentNamespaceArgs {
#[inline]
fn default() -> Self {
@@ -66,6 +70,7 @@ 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> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for 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,

View File

@@ -2,10 +2,13 @@
// @generated
extern crate alloc;
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] = [
@@ -15,6 +18,7 @@ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[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);
@@ -24,6 +28,7 @@ impl FromInclude {
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 {
@@ -32,6 +37,7 @@ impl FromInclude {
}
}
}
impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
@@ -41,8 +47,10 @@ impl ::core::fmt::Debug for FromInclude {
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
@@ -52,6 +60,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
@@ -60,10 +69,12 @@ impl ::flatbuffers::Push for FromInclude {
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 {

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableB<'a> {
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>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableB<'_> {
Ok(())
}
}
pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
}
impl<'a> Default for TableBArgs<'a> {
#[inline]
fn default() -> Self {
@@ -83,11 +88,13 @@ 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();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableB<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
Self {
@@ -122,6 +132,7 @@ impl Default for TableBT {
}
}
}
impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
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")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for Unused {
}
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 {
unsafe { <&'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 {
unsafe { ::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 = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
@@ -110,6 +120,7 @@ impl<'a> Unused {
pub struct UnusedT {
pub a: i32,
}
impl UnusedT {
pub fn pack(&self) -> Unused {
Unused::new(
@@ -117,4 +128,3 @@ impl UnusedT {
)
}
}

View File

@@ -2,15 +2,17 @@
// @generated
extern crate alloc;
use super::*;
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
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: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableA<'a> {
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>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
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 {
@@ -83,11 +88,13 @@ 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();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
}
impl Default for TableAT {
fn default() -> Self {
Self {
@@ -122,6 +132,7 @@ impl Default for TableAT {
}
}
}
impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,