mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 10:21:48 +00:00
Generate better formatted Rust code (#8919)
* Cleans up Rust formatting * Regenerates generated schemas
This commit is contained in:
@@ -4,15 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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")
|
||||
@@ -23,27 +26,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)
|
||||
@@ -116,6 +126,7 @@ impl<'a> Ability {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn key_compare_less_than(&self, o: &Ability) -> bool {
|
||||
self.id() < o.id()
|
||||
@@ -168,6 +179,7 @@ pub struct AbilityT {
|
||||
pub id: u32,
|
||||
pub distance: u32,
|
||||
}
|
||||
|
||||
impl AbilityT {
|
||||
pub fn pack(&self) -> Ability {
|
||||
Ability::new(
|
||||
@@ -176,4 +188,3 @@ impl AbilityT {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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] = [
|
||||
@@ -20,6 +23,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);
|
||||
@@ -35,6 +39,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 {
|
||||
@@ -46,6 +51,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() {
|
||||
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for AnyAmbiguousAliases {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for AnyAmbiguousAliases {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> 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) };
|
||||
@@ -94,6 +102,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) };
|
||||
@@ -102,10 +111,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 {
|
||||
@@ -124,6 +135,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyAmbiguousAliases {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
|
||||
|
||||
pub struct AnyAmbiguousAliasesUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -135,11 +147,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 {
|
||||
@@ -149,6 +163,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,
|
||||
@@ -157,6 +172,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 {
|
||||
@@ -170,14 +186,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 {
|
||||
@@ -191,14 +210,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 {
|
||||
@@ -212,12 +234,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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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] = [
|
||||
@@ -20,6 +23,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);
|
||||
@@ -35,6 +39,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 {
|
||||
@@ -46,6 +51,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() {
|
||||
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for Any {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Any {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> 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) };
|
||||
@@ -94,6 +102,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) };
|
||||
@@ -102,10 +111,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 {
|
||||
@@ -124,6 +135,7 @@ impl<'a> ::flatbuffers::Verifiable for Any {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
|
||||
|
||||
pub struct AnyUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -135,11 +147,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 {
|
||||
@@ -149,6 +163,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,
|
||||
@@ -157,6 +172,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 {
|
||||
@@ -170,14 +186,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 {
|
||||
@@ -191,14 +210,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 {
|
||||
@@ -212,12 +234,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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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] = [
|
||||
@@ -20,6 +23,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);
|
||||
@@ -35,6 +39,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 {
|
||||
@@ -46,6 +51,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() {
|
||||
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for AnyUniqueAliases {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for AnyUniqueAliases {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> 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) };
|
||||
@@ -94,6 +102,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) };
|
||||
@@ -102,10 +111,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 {
|
||||
@@ -124,6 +135,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyUniqueAliases {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
|
||||
|
||||
pub struct AnyUniqueAliasesUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -135,11 +147,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 {
|
||||
@@ -149,6 +163,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,
|
||||
@@ -157,6 +172,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 {
|
||||
@@ -170,14 +186,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 {
|
||||
@@ -191,14 +210,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 {
|
||||
@@ -212,12 +234,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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use super::*;
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
mod bitflags_color {
|
||||
::flatbuffers::bitflags::bitflags! {
|
||||
@@ -19,6 +20,7 @@ mod bitflags_color {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use self::bitflags_color::Color;
|
||||
|
||||
impl Serialize for Color {
|
||||
@@ -32,6 +34,7 @@ impl Serialize for 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) };
|
||||
@@ -41,6 +44,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()) };
|
||||
@@ -49,10 +53,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 {
|
||||
|
||||
@@ -4,6 +4,7 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use super::*;
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
mod bitflags_long_enum {
|
||||
::flatbuffers::bitflags::bitflags! {
|
||||
@@ -15,6 +16,7 @@ mod bitflags_long_enum {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use self::bitflags_long_enum::LongEnum;
|
||||
|
||||
impl Serialize for LongEnum {
|
||||
@@ -28,6 +30,7 @@ impl Serialize for 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) };
|
||||
@@ -37,6 +40,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()) };
|
||||
@@ -45,10 +49,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 {
|
||||
|
||||
@@ -4,16 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -91,6 +93,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>,
|
||||
@@ -396,6 +399,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:
|
||||
@@ -403,6 +407,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:
|
||||
@@ -410,6 +415,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:
|
||||
@@ -417,6 +423,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()
|
||||
@@ -427,6 +434,7 @@ impl<'a> Monster<'a> {
|
||||
let key = self.name();
|
||||
key.cmp(val)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
|
||||
// Safety:
|
||||
@@ -434,6 +442,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:
|
||||
@@ -441,6 +450,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:
|
||||
@@ -448,6 +458,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:
|
||||
@@ -455,6 +466,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:
|
||||
@@ -462,6 +474,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:
|
||||
@@ -469,6 +482,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]
|
||||
@@ -478,6 +492,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:
|
||||
@@ -485,6 +500,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:
|
||||
@@ -492,6 +508,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;
|
||||
@@ -501,6 +518,7 @@ impl<'a> Monster<'a> {
|
||||
unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) }
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn testempty(&self) -> Option<Stat<'a>> {
|
||||
// Safety:
|
||||
@@ -508,6 +526,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:
|
||||
@@ -515,6 +534,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:
|
||||
@@ -522,6 +542,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:
|
||||
@@ -529,6 +550,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:
|
||||
@@ -536,6 +558,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:
|
||||
@@ -543,6 +566,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:
|
||||
@@ -550,6 +574,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:
|
||||
@@ -557,6 +582,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:
|
||||
@@ -564,6 +590,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:
|
||||
@@ -571,6 +598,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:
|
||||
@@ -578,6 +606,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:
|
||||
@@ -585,6 +614,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:
|
||||
@@ -592,6 +622,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:
|
||||
@@ -599,6 +630,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:
|
||||
@@ -606,6 +638,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:
|
||||
@@ -613,6 +646,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:
|
||||
@@ -620,6 +654,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:
|
||||
@@ -627,6 +662,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:
|
||||
@@ -634,6 +670,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:
|
||||
@@ -641,6 +678,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:
|
||||
@@ -648,6 +686,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:
|
||||
@@ -655,6 +694,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:
|
||||
@@ -662,6 +702,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:
|
||||
@@ -669,6 +710,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:
|
||||
@@ -676,6 +718,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:
|
||||
@@ -683,6 +726,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:
|
||||
@@ -690,6 +734,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:
|
||||
@@ -697,6 +742,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:
|
||||
@@ -704,6 +750,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:
|
||||
@@ -711,6 +758,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:
|
||||
@@ -718,6 +766,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:
|
||||
@@ -725,6 +774,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:
|
||||
@@ -732,6 +782,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:
|
||||
@@ -739,6 +790,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:
|
||||
@@ -746,6 +798,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:
|
||||
@@ -753,6 +806,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;
|
||||
@@ -762,6 +816,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:
|
||||
@@ -769,6 +824,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:
|
||||
@@ -776,6 +832,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:
|
||||
@@ -783,6 +840,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:
|
||||
@@ -790,6 +848,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:
|
||||
@@ -797,6 +856,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:
|
||||
@@ -804,6 +864,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:
|
||||
@@ -811,6 +872,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:
|
||||
@@ -818,6 +880,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:
|
||||
@@ -825,6 +888,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:
|
||||
@@ -832,6 +896,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:
|
||||
@@ -839,6 +904,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:
|
||||
@@ -846,6 +912,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>> {
|
||||
@@ -980,7 +1047,6 @@ impl<'a> Monster<'a> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for Monster<'_> {
|
||||
@@ -1072,6 +1138,7 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MonsterArgs<'a> {
|
||||
pub pos: Option<&'a Vec3>,
|
||||
pub mana: i16,
|
||||
@@ -1135,6 +1202,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 {
|
||||
@@ -1433,251 +1501,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();
|
||||
@@ -1686,6 +1816,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_);
|
||||
@@ -1839,6 +1970,7 @@ impl ::core::fmt::Debug for Monster<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct MonsterT {
|
||||
@@ -1901,6 +2033,7 @@ pub struct MonsterT {
|
||||
pub negative_infinity_default: f32,
|
||||
pub double_inf_default: f64,
|
||||
}
|
||||
|
||||
impl Default for MonsterT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -1965,6 +2098,7 @@ impl Default for MonsterT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MonsterT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
@@ -2147,66 +2281,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]
|
||||
|
||||
@@ -4,10 +4,13 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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] = [
|
||||
@@ -20,6 +23,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);
|
||||
@@ -35,6 +39,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 {
|
||||
@@ -46,6 +51,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() {
|
||||
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for Race {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Race {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> 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) };
|
||||
@@ -94,6 +102,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) };
|
||||
@@ -102,10 +111,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 {
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -30,6 +32,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>,
|
||||
@@ -54,6 +57,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()
|
||||
@@ -77,9 +81,11 @@ impl ::flatbuffers::Verifiable for Referrable<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ReferrableArgs {
|
||||
pub id: u64,
|
||||
}
|
||||
|
||||
impl<'a> Default for ReferrableArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -104,11 +110,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();
|
||||
@@ -117,6 +125,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_);
|
||||
@@ -131,11 +140,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 {
|
||||
@@ -143,6 +154,7 @@ impl Default for ReferrableT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ReferrableT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -32,6 +34,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>,
|
||||
@@ -64,6 +67,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:
|
||||
@@ -71,6 +75,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:
|
||||
@@ -78,6 +83,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()
|
||||
@@ -103,11 +109,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 {
|
||||
@@ -140,19 +148,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();
|
||||
@@ -161,6 +173,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_);
|
||||
@@ -177,6 +190,7 @@ impl ::core::fmt::Debug for Stat<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct StatT {
|
||||
@@ -184,6 +198,7 @@ pub struct StatT {
|
||||
pub val: i64,
|
||||
pub count: u16,
|
||||
}
|
||||
|
||||
impl Default for StatT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -193,6 +208,7 @@ impl Default for StatT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StatT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -4,15 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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")
|
||||
@@ -24,27 +27,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)
|
||||
@@ -142,6 +152,7 @@ pub struct StructOfStructsT {
|
||||
pub b: TestT,
|
||||
pub c: AbilityT,
|
||||
}
|
||||
|
||||
impl StructOfStructsT {
|
||||
pub fn pack(&self) -> StructOfStructs {
|
||||
StructOfStructs::new(
|
||||
@@ -151,4 +162,3 @@ impl StructOfStructsT {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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")
|
||||
@@ -22,27 +25,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)
|
||||
@@ -106,6 +116,7 @@ impl<'a> StructOfStructsOfStructs {
|
||||
pub struct StructOfStructsOfStructsT {
|
||||
pub a: StructOfStructsT,
|
||||
}
|
||||
|
||||
impl StructOfStructsOfStructsT {
|
||||
pub fn pack(&self) -> StructOfStructsOfStructs {
|
||||
StructOfStructsOfStructs::new(
|
||||
@@ -113,4 +124,3 @@ impl StructOfStructsOfStructsT {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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")
|
||||
@@ -23,27 +26,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)
|
||||
@@ -158,6 +168,7 @@ pub struct TestT {
|
||||
pub a: i16,
|
||||
pub b: i8,
|
||||
}
|
||||
|
||||
impl TestT {
|
||||
pub fn pack(&self) -> Test {
|
||||
Test::new(
|
||||
@@ -166,4 +177,3 @@ impl TestT {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -30,6 +32,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>,
|
||||
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TestSimpleTableWithEnumArgs {
|
||||
pub color: Color,
|
||||
}
|
||||
|
||||
impl<'a> Default for TestSimpleTableWithEnumArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -94,11 +99,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();
|
||||
@@ -107,6 +114,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_);
|
||||
@@ -121,11 +129,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 {
|
||||
@@ -133,6 +143,7 @@ impl Default for TestSimpleTableWithEnumT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TestSimpleTableWithEnumT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -41,6 +43,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>,
|
||||
@@ -102,6 +105,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:
|
||||
@@ -109,6 +113,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:
|
||||
@@ -116,6 +121,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:
|
||||
@@ -123,6 +129,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:
|
||||
@@ -130,6 +137,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:
|
||||
@@ -137,6 +145,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:
|
||||
@@ -144,6 +153,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:
|
||||
@@ -151,6 +161,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:
|
||||
@@ -158,6 +169,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:
|
||||
@@ -165,6 +177,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:
|
||||
@@ -172,6 +185,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:
|
||||
@@ -203,6 +217,7 @@ impl ::flatbuffers::Verifiable for TypeAliases<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TypeAliasesArgs<'a> {
|
||||
pub i8_: i8,
|
||||
pub u8_: u8,
|
||||
@@ -217,6 +232,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 {
|
||||
@@ -271,55 +287,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();
|
||||
@@ -328,6 +357,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_);
|
||||
@@ -353,6 +383,7 @@ impl ::core::fmt::Debug for TypeAliases<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TypeAliasesT {
|
||||
@@ -369,6 +400,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 {
|
||||
@@ -387,6 +419,7 @@ impl Default for TypeAliasesT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeAliasesT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -4,15 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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")
|
||||
@@ -27,27 +30,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)
|
||||
@@ -281,6 +291,7 @@ pub struct Vec3T {
|
||||
pub test2: Color,
|
||||
pub test3: TestT,
|
||||
}
|
||||
|
||||
impl Vec3T {
|
||||
pub fn pack(&self) -> Vec3 {
|
||||
Vec3::new(
|
||||
@@ -293,4 +304,3 @@ impl Vec3T {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -20,7 +22,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"
|
||||
}
|
||||
@@ -29,6 +30,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>,
|
||||
@@ -54,8 +56,10 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MonsterArgs {
|
||||
}
|
||||
|
||||
impl<'a> Default for MonsterArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -78,6 +82,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> {
|
||||
@@ -87,6 +92,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_);
|
||||
@@ -100,16 +106,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,
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -20,7 +22,6 @@ impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
|
||||
}
|
||||
|
||||
impl<'a> InParentNamespace<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"MyGame.InParentNamespace"
|
||||
}
|
||||
@@ -29,6 +30,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>,
|
||||
@@ -54,8 +56,10 @@ impl ::flatbuffers::Verifiable for InParentNamespace<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InParentNamespaceArgs {
|
||||
}
|
||||
|
||||
impl<'a> Default for InParentNamespaceArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -78,6 +82,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> {
|
||||
@@ -87,6 +92,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_);
|
||||
@@ -100,16 +106,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,
|
||||
|
||||
@@ -4,10 +4,13 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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] = [
|
||||
@@ -17,6 +20,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);
|
||||
@@ -26,6 +30,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 {
|
||||
@@ -34,6 +39,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() {
|
||||
@@ -43,6 +49,7 @@ impl ::core::fmt::Debug for FromInclude {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FromInclude {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -73,6 +80,7 @@ impl<'de> serde::Deserialize<'de> 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) };
|
||||
@@ -82,6 +90,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) };
|
||||
@@ -90,10 +99,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 {
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -30,6 +32,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>,
|
||||
@@ -69,9 +72,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 {
|
||||
@@ -100,11 +105,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();
|
||||
@@ -113,6 +120,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_);
|
||||
@@ -127,11 +135,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 {
|
||||
@@ -139,6 +149,7 @@ impl Default for TableBT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TableBT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -4,15 +4,18 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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")
|
||||
@@ -22,27 +25,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)
|
||||
@@ -123,6 +133,7 @@ impl<'a> Unused {
|
||||
pub struct UnusedT {
|
||||
pub a: i32,
|
||||
}
|
||||
|
||||
impl UnusedT {
|
||||
pub fn pack(&self) -> Unused {
|
||||
Unused::new(
|
||||
@@ -130,4 +141,3 @@ impl UnusedT {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,17 @@ extern crate alloc;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
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) } }
|
||||
@@ -30,6 +32,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>,
|
||||
@@ -69,9 +72,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 {
|
||||
@@ -100,11 +105,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();
|
||||
@@ -113,6 +120,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_);
|
||||
@@ -127,11 +135,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 {
|
||||
@@ -139,6 +149,7 @@ impl Default for TableAT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TableAT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user