Fixes unused imports in Rust code generator (#8828)

* Fixes unused imports in Rust code generator

* Regenerates generated schemas
This commit is contained in:
Cameron Mulhern
2025-12-05 00:59:47 -05:00
committed by GitHub
parent 5469bc9ef1
commit cfce38ec99
92 changed files with 3051 additions and 3771 deletions

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_COLOR: i8 = 0; pub const ENUM_MIN_COLOR: i8 = 0;
@@ -47,8 +40,8 @@ impl Color {
} }
} }
} }
impl core::fmt::Debug for Color { impl ::core::fmt::Debug for Color {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for Color {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for Color { impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Color { impl ::flatbuffers::Push for Color {
type Output = Color; type Output = Color;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Color { impl ::flatbuffers::EndianScalar for Color {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for Color {
} }
} }
impl<'a> flatbuffers::Verifiable for Color { impl<'a> ::flatbuffers::Verifiable for Color {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Color {} impl ::flatbuffers::SimpleToVerifyInSlice for Color {}

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_EQUIPMENT: u8 = 0; pub const ENUM_MIN_EQUIPMENT: u8 = 0;
@@ -43,8 +36,8 @@ impl Equipment {
} }
} }
} }
impl core::fmt::Debug for Equipment { impl ::core::fmt::Debug for Equipment {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -52,24 +45,24 @@ impl core::fmt::Debug for Equipment {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for Equipment { impl<'a> ::flatbuffers::Follow<'a> for Equipment {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Equipment { impl ::flatbuffers::Push for Equipment {
type Output = Equipment; type Output = Equipment;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Equipment { impl ::flatbuffers::EndianScalar for Equipment {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -83,17 +76,16 @@ impl flatbuffers::EndianScalar for Equipment {
} }
} }
impl<'a> flatbuffers::Verifiable for Equipment { impl<'a> ::flatbuffers::Verifiable for Equipment {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Equipment {} impl ::flatbuffers::SimpleToVerifyInSlice for Equipment {}
pub struct EquipmentUnionTableOffset {} pub struct EquipmentUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -101,7 +93,7 @@ pub struct EquipmentUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum EquipmentT { pub enum EquipmentT {
NONE, NONE,
Weapon(Box<WeaponT>), Weapon(alloc::boxed::Box<WeaponT>),
} }
impl Default for EquipmentT { impl Default for EquipmentT {
fn default() -> Self { fn default() -> Self {
@@ -115,16 +107,16 @@ impl EquipmentT {
Self::Weapon(_) => Equipment::Weapon, Self::Weapon(_) => Equipment::Weapon,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::Weapon(v) => Some(v.pack(fbb).as_union_value()), Self::Weapon(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned WeaponT, setting the union to NONE. /// If the union variant matches, return the owned WeaponT, setting the union to NONE.
pub fn take_weapon(&mut self) -> Option<Box<WeaponT>> { pub fn take_weapon(&mut self) -> Option<alloc::boxed::Box<WeaponT>> {
if let Self::Weapon(_) = self { if let Self::Weapon(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Weapon(w) = v { if let Self::Weapon(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,54 +1,47 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum MonsterOffset {} pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Monster<'a> { impl<'a> Monster<'a> {
pub const VT_POS: flatbuffers::VOffsetT = 4; pub const VT_POS: ::flatbuffers::VOffsetT = 4;
pub const VT_MANA: flatbuffers::VOffsetT = 6; pub const VT_MANA: ::flatbuffers::VOffsetT = 6;
pub const VT_HP: flatbuffers::VOffsetT = 8; pub const VT_HP: ::flatbuffers::VOffsetT = 8;
pub const VT_NAME: flatbuffers::VOffsetT = 10; pub const VT_NAME: ::flatbuffers::VOffsetT = 10;
pub const VT_INVENTORY: flatbuffers::VOffsetT = 14; pub const VT_INVENTORY: ::flatbuffers::VOffsetT = 14;
pub const VT_COLOR: flatbuffers::VOffsetT = 16; pub const VT_COLOR: ::flatbuffers::VOffsetT = 16;
pub const VT_WEAPONS: flatbuffers::VOffsetT = 18; pub const VT_WEAPONS: ::flatbuffers::VOffsetT = 18;
pub const VT_EQUIPPED_TYPE: flatbuffers::VOffsetT = 20; pub const VT_EQUIPPED_TYPE: ::flatbuffers::VOffsetT = 20;
pub const VT_EQUIPPED: flatbuffers::VOffsetT = 22; pub const VT_EQUIPPED: ::flatbuffers::VOffsetT = 22;
pub const VT_PATH: flatbuffers::VOffsetT = 24; pub const VT_PATH: ::flatbuffers::VOffsetT = 24;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Sample.Monster" "MyGame.Sample.Monster"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args MonsterArgs<'args> args: &'args MonsterArgs<'args>
) -> flatbuffers::WIPOffset<Monster<'bldr>> { ) -> ::flatbuffers::WIPOffset<Monster<'bldr>> {
let mut builder = MonsterBuilder::new(_fbb); let mut builder = MonsterBuilder::new(_fbb);
if let Some(x) = args.path { builder.add_path(x); } if let Some(x) = args.path { builder.add_path(x); }
if let Some(x) = args.equipped { builder.add_equipped(x); } if let Some(x) = args.equipped { builder.add_equipped(x); }
@@ -70,7 +63,7 @@ impl<'a> Monster<'a> {
let mana = self.mana(); let mana = self.mana();
let hp = self.hp(); let hp = self.hp();
let name = self.name().map(|x| { let name = self.name().map(|x| {
x.to_string() alloc::string::ToString::to_string(x)
}); });
let inventory = self.inventory().map(|x| { let inventory = self.inventory().map(|x| {
x.into_iter().collect() x.into_iter().collect()
@@ -81,7 +74,7 @@ impl<'a> Monster<'a> {
}); });
let equipped = match self.equipped_type() { let equipped = match self.equipped_type() {
Equipment::NONE => EquipmentT::NONE, Equipment::NONE => EquipmentT::NONE,
Equipment::Weapon => EquipmentT::Weapon(Box::new( Equipment::Weapon => EquipmentT::Weapon(alloc::boxed::Box::new(
self.equipped_as_weapon() self.equipped_as_weapon()
.expect("Invalid union table, expected `Equipment::Weapon`.") .expect("Invalid union table, expected `Equipment::Weapon`.")
.unpack() .unpack()
@@ -130,14 +123,14 @@ impl<'a> Monster<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None)}
} }
#[inline] #[inline]
pub fn inventory(&self) -> Option<flatbuffers::Vector<'a, u8>> { pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)}
} }
#[inline] #[inline]
pub fn color(&self) -> Color { pub fn color(&self) -> Color {
@@ -147,11 +140,11 @@ impl<'a> Monster<'a> {
unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()} unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()}
} }
#[inline] #[inline]
pub fn weapons(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Weapon<'a>>>> { pub fn weapons(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon<'a>>>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Weapon>>>>(Monster::VT_WEAPONS, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon>>>>(Monster::VT_WEAPONS, None)}
} }
#[inline] #[inline]
pub fn equipped_type(&self) -> Equipment { pub fn equipped_type(&self) -> Equipment {
@@ -161,18 +154,18 @@ impl<'a> Monster<'a> {
unsafe { self._tab.get::<Equipment>(Monster::VT_EQUIPPED_TYPE, Some(Equipment::NONE)).unwrap()} unsafe { self._tab.get::<Equipment>(Monster::VT_EQUIPPED_TYPE, Some(Equipment::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn equipped(&self) -> Option<flatbuffers::Table<'a>> { pub fn equipped(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_EQUIPPED, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_EQUIPPED, None)}
} }
#[inline] #[inline]
pub fn path(&self) -> Option<flatbuffers::Vector<'a, Vec3>> { pub fn path(&self) -> Option<::flatbuffers::Vector<'a, Vec3>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Vec3>>>(Monster::VT_PATH, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Vec3>>>(Monster::VT_PATH, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
@@ -191,27 +184,26 @@ impl<'a> Monster<'a> {
} }
impl flatbuffers::Verifiable for Monster<'_> { impl ::flatbuffers::Verifiable for Monster<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<Vec3>("pos", Self::VT_POS, false)? .visit_field::<Vec3>("pos", Self::VT_POS, false)?
.visit_field::<i16>("mana", Self::VT_MANA, false)? .visit_field::<i16>("mana", Self::VT_MANA, false)?
.visit_field::<i16>("hp", Self::VT_HP, false)? .visit_field::<i16>("hp", Self::VT_HP, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)? .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("inventory", Self::VT_INVENTORY, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>("inventory", Self::VT_INVENTORY, false)?
.visit_field::<Color>("color", Self::VT_COLOR, false)? .visit_field::<Color>("color", Self::VT_COLOR, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Weapon>>>>("weapons", Self::VT_WEAPONS, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<Weapon>>>>("weapons", Self::VT_WEAPONS, false)?
.visit_union::<Equipment, _>("equipped_type", Self::VT_EQUIPPED_TYPE, "equipped", Self::VT_EQUIPPED, false, |key, v, pos| { .visit_union::<Equipment, _>("equipped_type", Self::VT_EQUIPPED_TYPE, "equipped", Self::VT_EQUIPPED, false, |key, v, pos| {
match key { match key {
Equipment::Weapon => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Weapon>>("Equipment::Weapon", pos), Equipment::Weapon => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<Weapon>>("Equipment::Weapon", pos),
_ => Ok(()), _ => Ok(()),
} }
})? })?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Vec3>>>("path", Self::VT_PATH, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, Vec3>>>("path", Self::VT_PATH, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
@@ -220,13 +212,13 @@ pub struct MonsterArgs<'a> {
pub pos: Option<&'a Vec3>, pub pos: Option<&'a Vec3>,
pub mana: i16, pub mana: i16,
pub hp: i16, pub hp: i16,
pub name: Option<flatbuffers::WIPOffset<&'a str>>, pub name: Option<::flatbuffers::WIPOffset<&'a str>>,
pub inventory: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>, pub inventory: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
pub color: Color, pub color: Color,
pub weapons: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Weapon<'a>>>>>, pub weapons: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon<'a>>>>>,
pub equipped_type: Equipment, pub equipped_type: Equipment,
pub equipped: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>, pub equipped: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
pub path: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Vec3>>>, pub path: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, Vec3>>>,
} }
impl<'a> Default for MonsterArgs<'a> { impl<'a> Default for MonsterArgs<'a> {
#[inline] #[inline]
@@ -246,11 +238,11 @@ impl<'a> Default for MonsterArgs<'a> {
} }
} }
pub struct MonsterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_pos(&mut self, pos: &Vec3) { pub fn add_pos(&mut self, pos: &Vec3) {
self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos); self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
@@ -264,35 +256,35 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100); self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
} }
#[inline] #[inline]
pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) { pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
} }
#[inline] #[inline]
pub fn add_inventory(&mut self, inventory: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) { pub fn add_inventory(&mut self, inventory: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
} }
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue); self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
} }
#[inline] #[inline]
pub fn add_weapons(&mut self, weapons: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Weapon<'b >>>>) { pub fn add_weapons(&mut self, weapons: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Weapon<'b >>>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_WEAPONS, weapons); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_WEAPONS, weapons);
} }
#[inline] #[inline]
pub fn add_equipped_type(&mut self, equipped_type: Equipment) { pub fn add_equipped_type(&mut self, equipped_type: Equipment) {
self.fbb_.push_slot::<Equipment>(Monster::VT_EQUIPPED_TYPE, equipped_type, Equipment::NONE); self.fbb_.push_slot::<Equipment>(Monster::VT_EQUIPPED_TYPE, equipped_type, Equipment::NONE);
} }
#[inline] #[inline]
pub fn add_equipped(&mut self, equipped: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) { pub fn add_equipped(&mut self, equipped: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_EQUIPPED, equipped); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_EQUIPPED, equipped);
} }
#[inline] #[inline]
pub fn add_path(&mut self, path: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Vec3>>) { pub fn add_path(&mut self, path: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Vec3>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_PATH, path); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_PATH, path);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
MonsterBuilder { MonsterBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -300,14 +292,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Monster<'_> { impl ::core::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Monster"); let mut ds = f.debug_struct("Monster");
ds.field("pos", &self.pos()); ds.field("pos", &self.pos());
ds.field("mana", &self.mana()); ds.field("mana", &self.mana());
@@ -340,12 +332,12 @@ pub struct MonsterT {
pub pos: Option<Vec3T>, pub pos: Option<Vec3T>,
pub mana: i16, pub mana: i16,
pub hp: i16, pub hp: i16,
pub name: Option<String>, pub name: Option<alloc::string::String>,
pub inventory: Option<Vec<u8>>, pub inventory: Option<alloc::vec::Vec<u8>>,
pub color: Color, pub color: Color,
pub weapons: Option<Vec<WeaponT>>, pub weapons: Option<alloc::vec::Vec<WeaponT>>,
pub equipped: EquipmentT, pub equipped: EquipmentT,
pub path: Option<Vec<Vec3T>>, pub path: Option<alloc::vec::Vec<Vec3T>>,
} }
impl Default for MonsterT { impl Default for MonsterT {
fn default() -> Self { fn default() -> Self {
@@ -363,10 +355,10 @@ impl Default for MonsterT {
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Monster<'b>> { ) -> ::flatbuffers::WIPOffset<Monster<'b>> {
let pos_tmp = self.pos.as_ref().map(|x| x.pack()); let pos_tmp = self.pos.as_ref().map(|x| x.pack());
let pos = pos_tmp.as_ref(); let pos = pos_tmp.as_ref();
let mana = self.mana; let mana = self.mana;
@@ -379,12 +371,12 @@ impl MonsterT {
}); });
let color = self.color; let color = self.color;
let weapons = self.weapons.as_ref().map(|x|{ let weapons = self.weapons.as_ref().map(|x|{
let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w) let w: alloc::vec::Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
}); });
let equipped_type = self.equipped.equipment_type(); let equipped_type = self.equipped.equipment_type();
let equipped = self.equipped.pack(_fbb); let equipped = self.equipped.pack(_fbb);
let path = self.path.as_ref().map(|x|{ let path = self.path.as_ref().map(|x|{
let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w) let w: alloc::vec::Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
}); });
Monster::create(_fbb, &MonsterArgs{ Monster::create(_fbb, &MonsterArgs{
pos, pos,
@@ -407,8 +399,8 @@ impl MonsterT {
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFlatbuffer> { pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<Monster>(buf) ::flatbuffers::root::<Monster>(buf)
} }
#[inline] #[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
@@ -417,8 +409,8 @@ pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFl
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_monster_unchecked`. /// `size_prefixed_root_as_monster_unchecked`.
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<Monster>(buf) ::flatbuffers::size_prefixed_root::<Monster>(buf)
} }
#[inline] #[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
@@ -428,10 +420,10 @@ pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuff
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
pub fn root_as_monster_with_opts<'b, 'o>( pub fn root_as_monster_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer> { ) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<Monster<'b>>(opts, buf) ::flatbuffers::root_with_opts::<Monster<'b>>(opts, buf)
} }
#[inline] #[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
@@ -441,33 +433,33 @@ pub fn root_as_monster_with_opts<'b, 'o>(
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>( pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<Monster<'b>, flatbuffers::InvalidFlatbuffer> { ) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf)
} }
#[inline] #[inline]
/// Assumes, without verification, that a buffer of bytes contains a Monster and returns it. /// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Monster`. /// Callers must trust the given bytes do indeed contain a valid `Monster`.
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> { pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { flatbuffers::root_unchecked::<Monster>(buf) } unsafe { ::flatbuffers::root_unchecked::<Monster>(buf) }
} }
#[inline] #[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> { pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) }
} }
#[inline] #[inline]
pub fn finish_monster_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( pub fn finish_monster_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<Monster<'a>>) { root: ::flatbuffers::WIPOffset<Monster<'a>>) {
fbb.finish(root, None); fbb.finish(root, None);
} }
#[inline] #[inline]
pub fn finish_size_prefixed_monster_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<Monster<'a>>) { pub fn finish_size_prefixed_monster_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<Monster<'a>>) {
fbb.finish_size_prefixed(root, None); fbb.finish_size_prefixed(root, None);
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Vec3, aligned to 4 // struct Vec3, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for Vec3 {
Self([0; 12]) Self([0; 12])
} }
} }
impl core::fmt::Debug for Vec3 { impl ::core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Vec3") f.debug_struct("Vec3")
.field("x", &self.x()) .field("x", &self.x())
.field("y", &self.y()) .field("y", &self.y())
@@ -28,40 +21,39 @@ impl core::fmt::Debug for Vec3 {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Vec3 {} impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {}
impl<'a> flatbuffers::Follow<'a> for Vec3 { impl<'a> ::flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Vec3>::follow(buf, loc) } unsafe { <&'a Vec3>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Vec3 { impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Vec3>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Vec3 { impl<'b> ::flatbuffers::Push for Vec3 {
type Output = Vec3; type Output = Vec3;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Vec3 { impl<'a> ::flatbuffers::Verifiable for Vec3 {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -85,88 +77,88 @@ impl<'a> Vec3 {
} }
pub fn x(&self) -> f32 { pub fn x(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_x(&mut self, x: f32) { pub fn set_x(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn y(&self) -> f32 { pub fn y(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_y(&mut self, x: f32) { pub fn set_y(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn z(&self) -> f32 { pub fn z(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(), self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_z(&mut self, x: f32) { pub fn set_z(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[8..].as_mut_ptr(), self.0[8..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,46 +1,39 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum WeaponOffset {} pub enum WeaponOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Weapon<'a> { pub struct Weapon<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Weapon<'a> { impl<'a> ::flatbuffers::Follow<'a> for Weapon<'a> {
type Inner = Weapon<'a>; type Inner = Weapon<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Weapon<'a> { impl<'a> Weapon<'a> {
pub const VT_NAME: flatbuffers::VOffsetT = 4; pub const VT_NAME: ::flatbuffers::VOffsetT = 4;
pub const VT_DAMAGE: flatbuffers::VOffsetT = 6; pub const VT_DAMAGE: ::flatbuffers::VOffsetT = 6;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Sample.Weapon" "MyGame.Sample.Weapon"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Weapon { _tab: table } Weapon { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args WeaponArgs<'args> args: &'args WeaponArgs<'args>
) -> flatbuffers::WIPOffset<Weapon<'bldr>> { ) -> ::flatbuffers::WIPOffset<Weapon<'bldr>> {
let mut builder = WeaponBuilder::new(_fbb); let mut builder = WeaponBuilder::new(_fbb);
if let Some(x) = args.name { builder.add_name(x); } if let Some(x) = args.name { builder.add_name(x); }
builder.add_damage(args.damage); builder.add_damage(args.damage);
@@ -49,7 +42,7 @@ impl<'a> Weapon<'a> {
pub fn unpack(&self) -> WeaponT { pub fn unpack(&self) -> WeaponT {
let name = self.name().map(|x| { let name = self.name().map(|x| {
x.to_string() alloc::string::ToString::to_string(x)
}); });
let damage = self.damage(); let damage = self.damage();
WeaponT { WeaponT {
@@ -63,7 +56,7 @@ impl<'a> Weapon<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Weapon::VT_NAME, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Weapon::VT_NAME, None)}
} }
#[inline] #[inline]
pub fn damage(&self) -> i16 { pub fn damage(&self) -> i16 {
@@ -74,21 +67,20 @@ impl<'a> Weapon<'a> {
} }
} }
impl flatbuffers::Verifiable for Weapon<'_> { impl ::flatbuffers::Verifiable for Weapon<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)? .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)?
.visit_field::<i16>("damage", Self::VT_DAMAGE, false)? .visit_field::<i16>("damage", Self::VT_DAMAGE, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct WeaponArgs<'a> { pub struct WeaponArgs<'a> {
pub name: Option<flatbuffers::WIPOffset<&'a str>>, pub name: Option<::flatbuffers::WIPOffset<&'a str>>,
pub damage: i16, pub damage: i16,
} }
impl<'a> Default for WeaponArgs<'a> { impl<'a> Default for WeaponArgs<'a> {
@@ -101,21 +93,21 @@ impl<'a> Default for WeaponArgs<'a> {
} }
} }
pub struct WeaponBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct WeaponBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> WeaponBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> WeaponBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) { pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Weapon::VT_NAME, name); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Weapon::VT_NAME, name);
} }
#[inline] #[inline]
pub fn add_damage(&mut self, damage: i16) { pub fn add_damage(&mut self, damage: i16) {
self.fbb_.push_slot::<i16>(Weapon::VT_DAMAGE, damage, 0); self.fbb_.push_slot::<i16>(Weapon::VT_DAMAGE, damage, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
WeaponBuilder { WeaponBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -123,14 +115,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> WeaponBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Weapon<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Weapon<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Weapon<'_> { impl ::core::fmt::Debug for Weapon<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Weapon"); let mut ds = f.debug_struct("Weapon");
ds.field("name", &self.name()); ds.field("name", &self.name());
ds.field("damage", &self.damage()); ds.field("damage", &self.damage());
@@ -140,7 +132,7 @@ impl core::fmt::Debug for Weapon<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct WeaponT { pub struct WeaponT {
pub name: Option<String>, pub name: Option<alloc::string::String>,
pub damage: i16, pub damage: i16,
} }
impl Default for WeaponT { impl Default for WeaponT {
@@ -152,10 +144,10 @@ impl Default for WeaponT {
} }
} }
impl WeaponT { impl WeaponT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Weapon<'b>> { ) -> ::flatbuffers::WIPOffset<Weapon<'b>> {
let name = self.name.as_ref().map(|x|{ let name = self.name.as_ref().map(|x|{
_fbb.create_string(x) _fbb.create_string(x)
}); });

View File

@@ -374,18 +374,11 @@ class RustGenerator : public BaseGenerator {
code_ += "// " + std::string(FlatBuffersGeneratedWarning()); code_ += "// " + std::string(FlatBuffersGeneratedWarning());
code_ += "// @generated"; code_ += "// @generated";
code_ += "extern crate alloc;"; code_ += "extern crate alloc;";
code_ += "extern crate flatbuffers;";
code_ += "use alloc::boxed::Box;";
code_ += "use alloc::string::{String, ToString};";
code_ += "use alloc::vec::Vec;";
code_ += "use core::mem;";
code_ += "use core::cmp::Ordering;";
if (parser_.opts.rust_serialize) { if (parser_.opts.rust_serialize) {
code_ += "extern crate serde;"; code_ += "extern crate serde;";
code_ += code_ +=
"use self::serde::ser::{Serialize, Serializer, SerializeStruct};"; "use self::serde::ser::{Serialize, Serializer, SerializeStruct};";
} }
code_ += "use self::flatbuffers::{EndianScalar, Follow};";
code_ += "use super::*;"; code_ += "use super::*;";
cur_name_space_ = symbol.defined_namespace; cur_name_space_ = symbol.defined_namespace;
gen_symbol(symbol); gen_symbol(symbol);
@@ -428,8 +421,9 @@ class RustGenerator : public BaseGenerator {
// structs, and tables) and output them to a single file. // structs, and tables) and output them to a single file.
bool GenerateOneFile() { bool GenerateOneFile() {
code_.Clear(); code_.Clear();
code_ += "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n"; code_ += "// " + std::string(FlatBuffersGeneratedWarning());
code_ += "// @generated"; code_ += "// @generated";
code_ += "extern crate alloc;";
assert(!cur_name_space_); assert(!cur_name_space_);
@@ -734,7 +728,7 @@ class RustGenerator : public BaseGenerator {
// constants but in camel case. // constants but in camel case.
code_ += "#[allow(non_upper_case_globals)]"; code_ += "#[allow(non_upper_case_globals)]";
code_ += "mod bitflags_{{ENUM_NAMESPACE}} {"; code_ += "mod bitflags_{{ENUM_NAMESPACE}} {";
code_ += " flatbuffers::bitflags::bitflags! {"; code_ += " ::flatbuffers::bitflags::bitflags! {";
GenComment(enum_def.doc_comment, " "); GenComment(enum_def.doc_comment, " ");
code_ += " #[derive(Default, Debug, Clone, Copy, PartialEq)]"; code_ += " #[derive(Default, Debug, Clone, Copy, PartialEq)]";
code_ += " {{ACCESS_TYPE}} struct {{ENUM_TY}}: {{BASE_TYPE}} {"; code_ += " {{ACCESS_TYPE}} struct {{ENUM_TY}}: {{BASE_TYPE}} {";
@@ -808,10 +802,10 @@ class RustGenerator : public BaseGenerator {
code_ += "}"; code_ += "}";
// Generate Debug. Unknown variants are printed like "<UNKNOWN 42>". // Generate Debug. Unknown variants are printed like "<UNKNOWN 42>".
code_ += "impl core::fmt::Debug for {{ENUM_TY}} {"; code_ += "impl ::core::fmt::Debug for {{ENUM_TY}} {";
code_ += code_ +=
" fn fmt(&self, f: &mut core::fmt::Formatter) ->" " fn fmt(&self, f: &mut ::core::fmt::Formatter) ->"
" core::fmt::Result {"; " ::core::fmt::Result {";
code_ += " if let Some(name) = self.variant_name() {"; code_ += " if let Some(name) = self.variant_name() {";
code_ += " f.write_str(name)"; code_ += " f.write_str(name)";
code_ += " } else {"; code_ += " } else {";
@@ -868,13 +862,13 @@ class RustGenerator : public BaseGenerator {
} }
// Generate Follow and Push so we can serialize and stuff. // Generate Follow and Push so we can serialize and stuff.
code_ += "impl<'a> flatbuffers::Follow<'a> for {{ENUM_TY}} {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{ENUM_TY}} {";
code_ += " type Inner = Self;"; code_ += " type Inner = Self;";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += code_ +=
" let b = unsafe { " " let b = unsafe { "
"flatbuffers::read_scalar_at::<{{BASE_TYPE}}>(buf, loc) };"; "::flatbuffers::read_scalar_at::<{{BASE_TYPE}}>(buf, loc) };";
if (IsBitFlagsEnum(enum_def)) { if (IsBitFlagsEnum(enum_def)) {
code_ += " Self::from_bits_retain(b)"; code_ += " Self::from_bits_retain(b)";
} else { } else {
@@ -883,17 +877,17 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "impl flatbuffers::Push for {{ENUM_TY}} {"; code_ += "impl ::flatbuffers::Push for {{ENUM_TY}} {";
code_ += " type Output = {{ENUM_TY}};"; code_ += " type Output = {{ENUM_TY}};";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {"; code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {";
code_ += code_ +=
" unsafe { flatbuffers::emplace_scalar::<{{BASE_TYPE}}>(dst, " " unsafe { ::flatbuffers::emplace_scalar::<{{BASE_TYPE}}>(dst, "
"{{INTO_BASE}}); }"; "{{INTO_BASE}}) };";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "impl flatbuffers::EndianScalar for {{ENUM_TY}} {"; code_ += "impl ::flatbuffers::EndianScalar for {{ENUM_TY}} {";
code_ += " type Scalar = {{BASE_TYPE}};"; code_ += " type Scalar = {{BASE_TYPE}};";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn to_little_endian(self) -> {{BASE_TYPE}} {"; code_ += " fn to_little_endian(self) -> {{BASE_TYPE}} {";
@@ -913,18 +907,17 @@ class RustGenerator : public BaseGenerator {
code_ += ""; code_ += "";
// Generate verifier - deferring to the base type. // Generate verifier - deferring to the base type.
code_ += "impl<'a> flatbuffers::Verifiable for {{ENUM_TY}} {"; code_ += "impl<'a> ::flatbuffers::Verifiable for {{ENUM_TY}} {";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn run_verifier("; code_ += " fn run_verifier(";
code_ += " v: &mut flatbuffers::Verifier, pos: usize"; code_ += " v: &mut ::flatbuffers::Verifier, pos: usize";
code_ += " ) -> Result<(), flatbuffers::InvalidFlatbuffer> {"; code_ += " ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {";
code_ += " use self::flatbuffers::Verifiable;";
code_ += " {{BASE_TYPE}}::run_verifier(v, pos)"; code_ += " {{BASE_TYPE}}::run_verifier(v, pos)";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
// Enums are basically integers. // Enums are basically integers.
code_ += "impl flatbuffers::SimpleToVerifyInSlice for {{ENUM_TY}} {}"; code_ += "impl ::flatbuffers::SimpleToVerifyInSlice for {{ENUM_TY}} {}";
if (enum_def.is_union) { if (enum_def.is_union) {
// Generate typesafe offset(s) for unions // Generate typesafe offset(s) for unions
@@ -969,7 +962,8 @@ class RustGenerator : public BaseGenerator {
code_ += "{{ACCESS_TYPE}} enum {{ENUM_OTY}} {"; code_ += "{{ACCESS_TYPE}} enum {{ENUM_OTY}} {";
code_ += " NONE,"; code_ += " NONE,";
ForAllUnionObjectVariantsBesidesNone(enum_def, [&] { ForAllUnionObjectVariantsBesidesNone(enum_def, [&] {
code_ += "{{NATIVE_VARIANT}}(Box<{{U_ELEMENT_TABLE_TYPE}}>),"; code_ +=
"{{NATIVE_VARIANT}}(alloc::boxed::Box<{{U_ELEMENT_TABLE_TYPE}}>),";
}); });
code_ += "}"; code_ += "}";
// Generate Default (NONE). // Generate Default (NONE).
@@ -996,9 +990,9 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
// Pack flatbuffers union value // Pack flatbuffers union value
code_ += code_ +=
" pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut " " pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut "
"flatbuffers::FlatBufferBuilder<'b, A>)" "::flatbuffers::FlatBufferBuilder<'b, A>)"
" -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>" " -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>"
" {"; " {";
code_ += " match self {"; code_ += " match self {";
code_ += " Self::NONE => None,"; code_ += " Self::NONE => None,";
@@ -1017,9 +1011,9 @@ class RustGenerator : public BaseGenerator {
"{{U_ELEMENT_TABLE_TYPE}}, setting the union to NONE."; "{{U_ELEMENT_TABLE_TYPE}}, setting the union to NONE.";
code_ += code_ +=
"pub fn take_{{U_ELEMENT_NAME}}(&mut self) -> " "pub fn take_{{U_ELEMENT_NAME}}(&mut self) -> "
"Option<Box<{{U_ELEMENT_TABLE_TYPE}}>> {"; "Option<alloc::boxed::Box<{{U_ELEMENT_TABLE_TYPE}}>> {";
code_ += " if let Self::{{NATIVE_VARIANT}}(_) = self {"; code_ += " if let Self::{{NATIVE_VARIANT}}(_) = self {";
code_ += " let v = core::mem::replace(self, Self::NONE);"; code_ += " let v = ::core::mem::replace(self, Self::NONE);";
code_ += " if let Self::{{NATIVE_VARIANT}}(w) = v {"; code_ += " if let Self::{{NATIVE_VARIANT}}(w) = v {";
code_ += " Some(w)"; code_ += " Some(w)";
code_ += " } else {"; code_ += " } else {";
@@ -1110,7 +1104,9 @@ class RustGenerator : public BaseGenerator {
// TODO: Escape strings? // TODO: Escape strings?
const std::string defval = const std::string defval =
field.IsRequired() ? "\"\"" : "\"" + field.value.constant + "\""; field.IsRequired() ? "\"\"" : "\"" + field.value.constant + "\"";
if (context == kObject) return defval + ".to_string()"; if (context == kObject) {
return "alloc::string::ToString::to_string(" + defval + ")";
}
if (context == kAccessor) return "&" + defval; if (context == kAccessor) return "&" + defval;
FLATBUFFERS_ASSERT(false); FLATBUFFERS_ASSERT(false);
return "INVALID_CODE_GENERATION"; return "INVALID_CODE_GENERATION";
@@ -1160,11 +1156,11 @@ class RustGenerator : public BaseGenerator {
return IsOptionalToBuilder(field) ? "Option<" + s + ">" : s; return IsOptionalToBuilder(field) ? "Option<" + s + ">" : s;
}; };
auto WrapVector = [&](std::string ty) { auto WrapVector = [&](std::string ty) {
return WrapOption("flatbuffers::WIPOffset<flatbuffers::Vector<" + return WrapOption("::flatbuffers::WIPOffset<::flatbuffers::Vector<" +
lifetime + ", " + ty + ">>"); lifetime + ", " + ty + ">>");
}; };
auto WrapUOffsetsVector = [&](std::string ty) { auto WrapUOffsetsVector = [&](std::string ty) {
return WrapVector("flatbuffers::ForwardsUOffset<" + ty + ">"); return WrapVector("::flatbuffers::ForwardsUOffset<" + ty + ">");
}; };
switch (GetFullType(type)) { switch (GetFullType(type)) {
@@ -1179,18 +1175,19 @@ class RustGenerator : public BaseGenerator {
} }
case ftTable: { case ftTable: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return WrapOption("flatbuffers::WIPOffset<" + typname + "<" + lifetime + return WrapOption("::flatbuffers::WIPOffset<" + typname + "<" +
">>"); lifetime + ">>");
} }
case ftString: { case ftString: {
return WrapOption("flatbuffers::WIPOffset<&" + lifetime + " str>"); return WrapOption("::flatbuffers::WIPOffset<&" + lifetime + " str>");
} }
case ftEnumKey: case ftEnumKey:
case ftUnionKey: { case ftUnionKey: {
return WrapOption(WrapInNameSpace(*type.enum_def)); return WrapOption(WrapInNameSpace(*type.enum_def));
} }
case ftUnionValue: { case ftUnionValue: {
return "Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>"; return "Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>"
">";
} }
case ftVectorOfInteger: case ftVectorOfInteger:
@@ -1215,7 +1212,7 @@ class RustGenerator : public BaseGenerator {
return WrapUOffsetsVector("&" + lifetime + " str"); return WrapUOffsetsVector("&" + lifetime + " str");
} }
case ftVectorOfUnionValue: { case ftVectorOfUnionValue: {
return WrapUOffsetsVector("flatbuffers::Table<" + lifetime + ">"); return WrapUOffsetsVector("::flatbuffers::Table<" + lifetime + ">");
} }
case ftArrayOfEnum: case ftArrayOfEnum:
case ftArrayOfStruct: case ftArrayOfStruct:
@@ -1238,7 +1235,7 @@ class RustGenerator : public BaseGenerator {
break; break;
} }
case ftString: { case ftString: {
ty = "String"; ty = "alloc::string::String";
break; break;
} }
case ftStruct: { case ftStruct: {
@@ -1248,7 +1245,8 @@ class RustGenerator : public BaseGenerator {
case ftTable: { case ftTable: {
// Since Tables can contain themselves, Box is required to avoid // Since Tables can contain themselves, Box is required to avoid
// infinite types. // infinite types.
ty = "Box<" + NamespacedNativeName(*type.struct_def) + ">"; ty =
"alloc::boxed::Box<" + NamespacedNativeName(*type.struct_def) + ">";
break; break;
} }
case ftUnionKey: { case ftUnionKey: {
@@ -1266,23 +1264,24 @@ class RustGenerator : public BaseGenerator {
} }
// Vectors are in tables and are optional // Vectors are in tables and are optional
case ftVectorOfEnumKey: { case ftVectorOfEnumKey: {
ty = "Vec<" + WrapInNameSpace(*type.VectorType().enum_def) + ">"; ty = "alloc::vec::Vec<" + WrapInNameSpace(*type.VectorType().enum_def) +
">";
break; break;
} }
case ftVectorOfInteger: case ftVectorOfInteger:
case ftVectorOfBool: case ftVectorOfBool:
case ftVectorOfFloat: { case ftVectorOfFloat: {
ty = "Vec<" + GetTypeBasic(type.VectorType()) + ">"; ty = "alloc::vec::Vec<" + GetTypeBasic(type.VectorType()) + ">";
break; break;
} }
case ftVectorOfString: { case ftVectorOfString: {
ty = "Vec<String>"; ty = "alloc::vec::Vec<alloc::string::String>";
break; break;
} }
case ftVectorOfTable: case ftVectorOfTable:
case ftVectorOfStruct: { case ftVectorOfStruct: {
ty = NamespacedNativeName(*type.VectorType().struct_def); ty = NamespacedNativeName(*type.VectorType().struct_def);
ty = "Vec<" + ty + ">"; ty = "alloc::vec::Vec<" + ty + ">";
break; break;
} }
case ftVectorOfUnionValue: { case ftVectorOfUnionValue: {
@@ -1319,35 +1318,35 @@ class RustGenerator : public BaseGenerator {
switch (GetFullType(field.value.type)) { switch (GetFullType(field.value.type)) {
case ftVectorOfStruct: { case ftVectorOfStruct: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return "flatbuffers::WIPOffset<flatbuffers::Vector<" + lifetime + ", " + return "::flatbuffers::WIPOffset<::flatbuffers::Vector<" + lifetime +
typname + ">>"; ", " + typname + ">>";
} }
case ftVectorOfTable: { case ftVectorOfTable: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return "flatbuffers::WIPOffset<flatbuffers::Vector<" + lifetime + return "::flatbuffers::WIPOffset<::flatbuffers::Vector<" + lifetime +
", flatbuffers::ForwardsUOffset<" + typname + "<" + lifetime + ", ::flatbuffers::ForwardsUOffset<" + typname + "<" + lifetime +
">>>>"; ">>>>";
} }
case ftVectorOfInteger: case ftVectorOfInteger:
case ftVectorOfBool: case ftVectorOfBool:
case ftVectorOfFloat: { case ftVectorOfFloat: {
const auto typname = GetTypeBasic(type.VectorType()); const auto typname = GetTypeBasic(type.VectorType());
return "flatbuffers::WIPOffset<flatbuffers::Vector<" + lifetime + ", " + return "::flatbuffers::WIPOffset<::flatbuffers::Vector<" + lifetime +
typname + ">>"; ", " + typname + ">>";
} }
case ftVectorOfString: { case ftVectorOfString: {
return "flatbuffers::WIPOffset<flatbuffers::Vector<" + lifetime + return "::flatbuffers::WIPOffset<::flatbuffers::Vector<" + lifetime +
", flatbuffers::ForwardsUOffset<&" + lifetime + " str>>>"; ", ::flatbuffers::ForwardsUOffset<&" + lifetime + " str>>>";
} }
case ftVectorOfEnumKey: { case ftVectorOfEnumKey: {
const auto typname = WrapInNameSpace(*type.enum_def); const auto typname = WrapInNameSpace(*type.enum_def);
return "flatbuffers::WIPOffset<flatbuffers::Vector<" + lifetime + ", " + return "::flatbuffers::WIPOffset<::flatbuffers::Vector<" + lifetime +
typname + ">>"; ", " + typname + ">>";
} }
case ftVectorOfUnionValue: { case ftVectorOfUnionValue: {
return "flatbuffers::WIPOffset<flatbuffers::Vector<" + lifetime + return "::flatbuffers::WIPOffset<::flatbuffers::Vector<" + lifetime +
", flatbuffers::ForwardsUOffset<flatbuffers::Table<" + lifetime + ", ::flatbuffers::ForwardsUOffset<::flatbuffers::Table<" +
">>>"; lifetime + ">>>";
} }
case ftEnumKey: case ftEnumKey:
case ftUnionKey: { case ftUnionKey: {
@@ -1360,7 +1359,7 @@ class RustGenerator : public BaseGenerator {
} }
case ftTable: { case ftTable: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return "flatbuffers::WIPOffset<" + typname + "<" + lifetime + ">>"; return "::flatbuffers::WIPOffset<" + typname + "<" + lifetime + ">>";
} }
case ftInteger: case ftInteger:
case ftBool: case ftBool:
@@ -1368,24 +1367,24 @@ class RustGenerator : public BaseGenerator {
return GetTypeBasic(type); return GetTypeBasic(type);
} }
case ftString: { case ftString: {
return "flatbuffers::WIPOffset<&" + lifetime + " str>"; return "::flatbuffers::WIPOffset<&" + lifetime + " str>";
} }
case ftUnionValue: { case ftUnionValue: {
return "flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>"; return "::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>";
} }
case ftArrayOfBuiltin: { case ftArrayOfBuiltin: {
const auto typname = GetTypeBasic(type.VectorType()); const auto typname = GetTypeBasic(type.VectorType());
return "flatbuffers::Array<" + lifetime + ", " + typname + ", " + return "::flatbuffers::Array<" + lifetime + ", " + typname + ", " +
NumToString(type.fixed_length) + ">"; NumToString(type.fixed_length) + ">";
} }
case ftArrayOfEnum: { case ftArrayOfEnum: {
const auto typname = WrapInNameSpace(*type.enum_def); const auto typname = WrapInNameSpace(*type.enum_def);
return "flatbuffers::Array<" + lifetime + ", " + typname + ", " + return "::flatbuffers::Array<" + lifetime + ", " + typname + ", " +
NumToString(type.fixed_length) + ">"; NumToString(type.fixed_length) + ">";
} }
case ftArrayOfStruct: { case ftArrayOfStruct: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return "flatbuffers::Array<" + lifetime + ", " + typname + ", " + return "::flatbuffers::Array<" + lifetime + ", " + typname + ", " +
NumToString(type.fixed_length) + ">"; NumToString(type.fixed_length) + ">";
} }
} }
@@ -1419,7 +1418,7 @@ class RustGenerator : public BaseGenerator {
} }
case ftTable: { case ftTable: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return "self.fbb_.push_slot_always::<flatbuffers::WIPOffset<" + return "self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<" +
typname + ">>"; typname + ">>";
} }
@@ -1433,7 +1432,7 @@ class RustGenerator : public BaseGenerator {
case ftVectorOfTable: case ftVectorOfTable:
case ftVectorOfString: case ftVectorOfString:
case ftVectorOfUnionValue: { case ftVectorOfUnionValue: {
return "self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>"; return "self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>";
} }
case ftArrayOfEnum: case ftArrayOfEnum:
case ftArrayOfStruct: case ftArrayOfStruct:
@@ -1472,7 +1471,7 @@ class RustGenerator : public BaseGenerator {
} }
case ftUnionValue: { case ftUnionValue: {
return WrapOption("flatbuffers::Table<" + lifetime + ">"); return WrapOption("::flatbuffers::Table<" + lifetime + ">");
} }
case ftString: { case ftString: {
return WrapOption("&" + lifetime + " str"); return WrapOption("&" + lifetime + " str");
@@ -1481,28 +1480,28 @@ class RustGenerator : public BaseGenerator {
case ftVectorOfBool: case ftVectorOfBool:
case ftVectorOfFloat: { case ftVectorOfFloat: {
const auto typname = GetTypeBasic(type.VectorType()); const auto typname = GetTypeBasic(type.VectorType());
return WrapOption("flatbuffers::Vector<" + lifetime + ", " + typname + return WrapOption("::flatbuffers::Vector<" + lifetime + ", " + typname +
">"); ">");
} }
case ftVectorOfEnumKey: { case ftVectorOfEnumKey: {
const auto typname = WrapInNameSpace(*type.enum_def); const auto typname = WrapInNameSpace(*type.enum_def);
return WrapOption("flatbuffers::Vector<" + lifetime + ", " + typname + return WrapOption("::flatbuffers::Vector<" + lifetime + ", " + typname +
">"); ">");
} }
case ftVectorOfStruct: { case ftVectorOfStruct: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return WrapOption("flatbuffers::Vector<" + lifetime + ", " + typname + return WrapOption("::flatbuffers::Vector<" + lifetime + ", " + typname +
">"); ">");
} }
case ftVectorOfTable: { case ftVectorOfTable: {
const auto typname = WrapInNameSpace(*type.struct_def); const auto typname = WrapInNameSpace(*type.struct_def);
return WrapOption("flatbuffers::Vector<" + lifetime + return WrapOption("::flatbuffers::Vector<" + lifetime +
", flatbuffers::ForwardsUOffset<" + typname + "<" + ", ::flatbuffers::ForwardsUOffset<" + typname + "<" +
lifetime + ">>>"); lifetime + ">>>");
} }
case ftVectorOfString: { case ftVectorOfString: {
return WrapOption("flatbuffers::Vector<" + lifetime + return WrapOption("::flatbuffers::Vector<" + lifetime +
", flatbuffers::ForwardsUOffset<&" + lifetime + ", ::flatbuffers::ForwardsUOffset<&" + lifetime +
" str>>"); " str>>");
} }
case ftVectorOfUnionValue: { case ftVectorOfUnionValue: {
@@ -1525,13 +1524,13 @@ class RustGenerator : public BaseGenerator {
// IsVector... This can be made iterative? // IsVector... This can be made iterative?
const auto WrapForwardsUOffset = [](std::string ty) -> std::string { const auto WrapForwardsUOffset = [](std::string ty) -> std::string {
return "flatbuffers::ForwardsUOffset<" + ty + ">"; return "::flatbuffers::ForwardsUOffset<" + ty + ">";
}; };
const auto WrapVector = [&](std::string ty) -> std::string { const auto WrapVector = [&](std::string ty) -> std::string {
return "flatbuffers::Vector<" + lifetime + ", " + ty + ">"; return "::flatbuffers::Vector<" + lifetime + ", " + ty + ">";
}; };
const auto WrapArray = [&](std::string ty, uint16_t length) -> std::string { const auto WrapArray = [&](std::string ty, uint16_t length) -> std::string {
return "flatbuffers::Array<" + lifetime + ", " + ty + ", " + return "::flatbuffers::Array<" + lifetime + ", " + ty + ", " +
NumToString(length) + ">"; NumToString(length) + ">";
}; };
switch (GetFullType(type)) { switch (GetFullType(type)) {
@@ -1552,7 +1551,7 @@ class RustGenerator : public BaseGenerator {
return WrapForwardsUOffset(typname); return WrapForwardsUOffset(typname);
} }
case ftUnionValue: { case ftUnionValue: {
return WrapForwardsUOffset("flatbuffers::Table<" + lifetime + ">"); return WrapForwardsUOffset("::flatbuffers::Table<" + lifetime + ">");
} }
case ftString: { case ftString: {
return WrapForwardsUOffset("&str"); return WrapForwardsUOffset("&str");
@@ -1690,14 +1689,15 @@ class RustGenerator : public BaseGenerator {
GenComment(struct_def.doc_comment); GenComment(struct_def.doc_comment);
code_ += "{{ACCESS_TYPE}} struct {{STRUCT_TY}}<'a> {"; code_ += "{{ACCESS_TYPE}} struct {{STRUCT_TY}}<'a> {";
code_ += " pub _tab: flatbuffers::Table<'a>,"; code_ += " pub _tab: ::flatbuffers::Table<'a>,";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "impl<'a> flatbuffers::Follow<'a> for {{STRUCT_TY}}<'a> {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{STRUCT_TY}}<'a> {";
code_ += " type Inner = {{STRUCT_TY}}<'a>;"; code_ += " type Inner = {{STRUCT_TY}}<'a>;";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += " Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }"; code_ +=
" Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
@@ -1707,7 +1707,7 @@ class RustGenerator : public BaseGenerator {
ForAllTableFields(struct_def, [&](const FieldDef& unused) { ForAllTableFields(struct_def, [&](const FieldDef& unused) {
(void)unused; (void)unused;
code_ += code_ +=
"pub const {{OFFSET_NAME}}: flatbuffers::VOffsetT = " "pub const {{OFFSET_NAME}}: ::flatbuffers::VOffsetT = "
"{{OFFSET_VALUE}};"; "{{OFFSET_VALUE}};";
}); });
code_ += ""; code_ += "";
@@ -1718,7 +1718,7 @@ class RustGenerator : public BaseGenerator {
code_ += " #[inline]"; code_ += " #[inline]";
code_ += code_ +=
" pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> " " pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> "
"Self {"; "Self {";
code_ += " {{STRUCT_TY}} { _tab: table }"; code_ += " {{STRUCT_TY}} { _tab: table }";
code_ += " }"; code_ += " }";
@@ -1731,11 +1731,11 @@ class RustGenerator : public BaseGenerator {
code_ += " #[allow(unused_mut)]"; code_ += " #[allow(unused_mut)]";
code_ += code_ +=
" pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: " " pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: "
"flatbuffers::Allocator + 'bldr>("; "::flatbuffers::Allocator + 'bldr>(";
code_ += code_ +=
" _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,"; " _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,";
code_ += " {{MAYBE_US}}args: &'args {{STRUCT_TY}}Args{{MAYBE_LT}}"; code_ += " {{MAYBE_US}}args: &'args {{STRUCT_TY}}Args{{MAYBE_LT}}";
code_ += " ) -> flatbuffers::WIPOffset<{{STRUCT_TY}}<'bldr>> {"; code_ += " ) -> ::flatbuffers::WIPOffset<{{STRUCT_TY}}<'bldr>> {";
code_ += " let mut builder = {{STRUCT_TY}}Builder::new(_fbb);"; code_ += " let mut builder = {{STRUCT_TY}}Builder::new(_fbb);";
for (size_t size = struct_def.sortbysize ? sizeof(largest_scalar_t) : 1; for (size_t size = struct_def.sortbysize ? sizeof(largest_scalar_t) : 1;
@@ -1789,7 +1789,8 @@ class RustGenerator : public BaseGenerator {
ForAllUnionObjectVariantsBesidesNone(enum_def, [&] { ForAllUnionObjectVariantsBesidesNone(enum_def, [&] {
code_ += code_ +=
" {{ENUM_TY}}::{{VARIANT_NAME}} => " " {{ENUM_TY}}::{{VARIANT_NAME}} => "
"{{NATIVE_ENUM_NAME}}::{{NATIVE_VARIANT}}(Box::new("; "{{NATIVE_ENUM_NAME}}::{{NATIVE_VARIANT}}(alloc::boxed::Box::"
"new(";
code_ += " self.{{FIELD}}_as_{{U_ELEMENT_NAME}}()"; code_ += " self.{{FIELD}}_as_{{U_ELEMENT_NAME}}()";
code_ += code_ +=
" .expect(\"Invalid union table, " " .expect(\"Invalid union table, "
@@ -1805,7 +1806,7 @@ class RustGenerator : public BaseGenerator {
// The rest of the types need special handling based on if the field // The rest of the types need special handling based on if the field
// is optional or not. // is optional or not.
case ftString: { case ftString: {
code_.SetValue("EXPR", "x.to_string()"); code_.SetValue("EXPR", "alloc::string::ToString::to_string(x)");
break; break;
} }
case ftStruct: { case ftStruct: {
@@ -1813,7 +1814,7 @@ class RustGenerator : public BaseGenerator {
break; break;
} }
case ftTable: { case ftTable: {
code_.SetValue("EXPR", "Box::new(x.unpack())"); code_.SetValue("EXPR", "alloc::boxed::Box::new(x.unpack())");
break; break;
} }
case ftVectorOfInteger: case ftVectorOfInteger:
@@ -1824,7 +1825,9 @@ class RustGenerator : public BaseGenerator {
break; break;
} }
case ftVectorOfString: { case ftVectorOfString: {
code_.SetValue("EXPR", "x.iter().map(|s| s.to_string()).collect()"); code_.SetValue("EXPR",
"x.iter().map(|s| "
"alloc::string::ToString::to_string(s)).collect()");
break; break;
} }
case ftVectorOfStruct: case ftVectorOfStruct:
@@ -1912,22 +1915,22 @@ class RustGenerator : public BaseGenerator {
if (field.IsRequired()) { if (field.IsRequired()) {
code_ += "{{NESTED}}<'a> {"; code_ += "{{NESTED}}<'a> {";
code_ += " let data = self.{{FIELD}}();"; code_ += " let data = self.{{FIELD}}();";
code_ += " use flatbuffers::Follow;"; code_ += " use ::flatbuffers::Follow;";
code_ += " // Safety:"; code_ += " // Safety:";
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid flatbuffer in this slot"; code_ += " // Which contains a valid flatbuffer in this slot";
code_ += code_ +=
" unsafe { <flatbuffers::ForwardsUOffset<{{NESTED}}<'a>>>" " unsafe { <::flatbuffers::ForwardsUOffset<{{NESTED}}<'a>>>"
"::follow(data.bytes(), 0) }"; "::follow(data.bytes(), 0) }";
} else { } else {
code_ += "Option<{{NESTED}}<'a>> {"; code_ += "Option<{{NESTED}}<'a>> {";
code_ += " self.{{FIELD}}().map(|data| {"; code_ += " self.{{FIELD}}().map(|data| {";
code_ += " use flatbuffers::Follow;"; code_ += " use ::flatbuffers::Follow;";
code_ += " // Safety:"; code_ += " // Safety:";
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid flatbuffer in this slot"; code_ += " // Which contains a valid flatbuffer in this slot";
code_ += code_ +=
" unsafe { <flatbuffers::ForwardsUOffset<{{NESTED}}<'a>>>" " unsafe { <::flatbuffers::ForwardsUOffset<{{NESTED}}<'a>>>"
"::follow(data.bytes(), 0) }"; "::follow(data.bytes(), 0) }";
code_ += " })"; code_ += " })";
} }
@@ -1991,12 +1994,11 @@ class RustGenerator : public BaseGenerator {
code_ += ""; code_ += "";
// Generate Verifier; // Generate Verifier;
code_ += "impl flatbuffers::Verifiable for {{STRUCT_TY}}<'_> {"; code_ += "impl ::flatbuffers::Verifiable for {{STRUCT_TY}}<'_> {";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn run_verifier("; code_ += " fn run_verifier(";
code_ += " v: &mut flatbuffers::Verifier, pos: usize"; code_ += " v: &mut ::flatbuffers::Verifier, pos: usize";
code_ += " ) -> Result<(), flatbuffers::InvalidFlatbuffer> {"; code_ += " ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {";
code_ += " use self::flatbuffers::Verifiable;";
code_ += " v.visit_table(pos)?\\"; code_ += " v.visit_table(pos)?\\";
// Escape newline and insert it onthe next line so we can end the builder // Escape newline and insert it onthe next line so we can end the builder
// with a nice semicolon. // with a nice semicolon.
@@ -2029,7 +2031,7 @@ class RustGenerator : public BaseGenerator {
(void)unused; (void)unused;
code_ += code_ +=
" {{U_ELEMENT_ENUM_TYPE}} => v.verify_union_variant::" " {{U_ELEMENT_ENUM_TYPE}} => v.verify_union_variant::"
"<flatbuffers::ForwardsUOffset<{{U_ELEMENT_TABLE_TYPE}}>>(" "<::flatbuffers::ForwardsUOffset<{{U_ELEMENT_TABLE_TYPE}}>>("
"\"{{U_ELEMENT_ENUM_TYPE}}\", pos),"; "\"{{U_ELEMENT_ENUM_TYPE}}\", pos),";
}); });
code_ += " _ => Ok(()),"; code_ += " _ => Ok(()),";
@@ -2137,16 +2139,16 @@ class RustGenerator : public BaseGenerator {
// Generate a builder struct: // Generate a builder struct:
code_ += code_ +=
"{{ACCESS_TYPE}} struct {{STRUCT_TY}}Builder<'a: 'b, 'b, A: " "{{ACCESS_TYPE}} struct {{STRUCT_TY}}Builder<'a: 'b, 'b, A: "
"flatbuffers::Allocator + 'a> {"; "::flatbuffers::Allocator + 'a> {";
code_ += " fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,"; code_ += " fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,";
code_ += code_ +=
" start_: flatbuffers::WIPOffset<" " start_: ::flatbuffers::WIPOffset<"
"flatbuffers::TableUnfinishedWIPOffset>,"; "::flatbuffers::TableUnfinishedWIPOffset>,";
code_ += "}"; code_ += "}";
// Generate builder functions: // Generate builder functions:
code_ += code_ +=
"impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> " "impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> "
"{{STRUCT_TY}}Builder<'a, " "{{STRUCT_TY}}Builder<'a, "
"'b, A> {"; "'b, A> {";
ForAllTableFields(struct_def, [&](const FieldDef& field) { ForAllTableFields(struct_def, [&](const FieldDef& field) {
@@ -2183,7 +2185,8 @@ class RustGenerator : public BaseGenerator {
// Struct initializer (all fields required); // Struct initializer (all fields required);
code_ += " #[inline]"; code_ += " #[inline]";
code_ += code_ +=
" pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> " " pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) "
"-> "
"{{STRUCT_TY}}Builder<'a, 'b, A> {"; "{{STRUCT_TY}}Builder<'a, 'b, A> {";
code_.SetValue("NUM_FIELDS", NumToString(struct_def.fields.vec.size())); code_.SetValue("NUM_FIELDS", NumToString(struct_def.fields.vec.size()));
code_ += " let start = _fbb.start_table();"; code_ += " let start = _fbb.start_table();";
@@ -2197,7 +2200,7 @@ class RustGenerator : public BaseGenerator {
code_ += " #[inline]"; code_ += " #[inline]";
code_ += code_ +=
" pub fn finish(self) -> " " pub fn finish(self) -> "
"flatbuffers::WIPOffset<{{STRUCT_TY}}<'a>> {"; "::flatbuffers::WIPOffset<{{STRUCT_TY}}<'a>> {";
code_ += " let o = self.fbb_.end_table(self.start_);"; code_ += " let o = self.fbb_.end_table(self.start_);";
ForAllTableFields(struct_def, [&](const FieldDef& field) { ForAllTableFields(struct_def, [&](const FieldDef& field) {
@@ -2206,15 +2209,15 @@ class RustGenerator : public BaseGenerator {
" self.fbb_.required(o, {{STRUCT_TY}}::{{OFFSET_NAME}}," " self.fbb_.required(o, {{STRUCT_TY}}::{{OFFSET_NAME}},"
"\"{{FIELD}}\");"; "\"{{FIELD}}\");";
}); });
code_ += " flatbuffers::WIPOffset::new(o.value())"; code_ += " ::flatbuffers::WIPOffset::new(o.value())";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "impl core::fmt::Debug for {{STRUCT_TY}}<'_> {"; code_ += "impl ::core::fmt::Debug for {{STRUCT_TY}}<'_> {";
code_ += code_ +=
" fn fmt(&self, f: &mut core::fmt::Formatter<'_>" " fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>"
") -> core::fmt::Result {"; ") -> ::core::fmt::Result {";
code_ += " let mut ds = f.debug_struct(\"{{STRUCT_TY}}\");"; code_ += " let mut ds = f.debug_struct(\"{{STRUCT_TY}}\");";
ForAllTableFields(struct_def, [&](const FieldDef& field) { ForAllTableFields(struct_def, [&](const FieldDef& field) {
if (GetFullType(field.value.type) == ftUnionValue) { if (GetFullType(field.value.type) == ftUnionValue) {
@@ -2287,10 +2290,10 @@ class RustGenerator : public BaseGenerator {
// Generate pack function. // Generate pack function.
code_ += "impl {{STRUCT_OTY}} {"; code_ += "impl {{STRUCT_OTY}} {";
code_ += " pub fn pack<'b, A: flatbuffers::Allocator + 'b>("; code_ += " pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(";
code_ += " &self,"; code_ += " &self,";
code_ += " _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>"; code_ += " _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>";
code_ += " ) -> flatbuffers::WIPOffset<{{STRUCT_TY}}<'b>> {"; code_ += " ) -> ::flatbuffers::WIPOffset<{{STRUCT_TY}}<'b>> {";
// First we generate variables for each field and then later assemble them // First we generate variables for each field and then later assemble them
// using "StructArgs" to more easily manage ownership of the builder. // using "StructArgs" to more easily manage ownership of the builder.
ForAllObjectTableFields(table, [&](const FieldDef& field) { ForAllObjectTableFields(table, [&](const FieldDef& field) {
@@ -2347,10 +2350,10 @@ class RustGenerator : public BaseGenerator {
return; return;
} }
case ftVectorOfStruct: { case ftVectorOfStruct: {
MapNativeTableField( MapNativeTableField(field,
field, "let w: alloc::vec::Vec<_> = x.iter().map(|t| "
"let w: Vec<_> = x.iter().map(|t| t.pack()).collect();" "t.pack()).collect();"
"_fbb.create_vector(&w)"); "_fbb.create_vector(&w)");
return; return;
} }
case ftVectorOfString: { case ftVectorOfString: {
@@ -2358,16 +2361,16 @@ class RustGenerator : public BaseGenerator {
// allocations. // allocations.
MapNativeTableField(field, MapNativeTableField(field,
"let w: Vec<_> = x.iter().map(|s| " "let w: alloc::vec::Vec<_> = x.iter().map(|s| "
"_fbb.create_string(s)).collect();" "_fbb.create_string(s)).collect();"
"_fbb.create_vector(&w)"); "_fbb.create_vector(&w)");
return; return;
} }
case ftVectorOfTable: { case ftVectorOfTable: {
MapNativeTableField( MapNativeTableField(field,
field, "let w: alloc::vec::Vec<_> = x.iter().map(|t| "
"let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();" "t.pack(_fbb)).collect();"
"_fbb.create_vector(&w)"); "_fbb.create_vector(&w)");
return; return;
} }
case ftVectorOfUnionValue: { case ftVectorOfUnionValue: {
@@ -2461,8 +2464,8 @@ class RustGenerator : public BaseGenerator {
code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`."; code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`.";
code_ += code_ +=
"pub fn root_as_{{STRUCT_FN}}(buf: &[u8]) " "pub fn root_as_{{STRUCT_FN}}(buf: &[u8]) "
"-> Result<{{STRUCT_TY}}<'_>, flatbuffers::InvalidFlatbuffer> {"; "-> Result<{{STRUCT_TY}}<'_>, ::flatbuffers::InvalidFlatbuffer> {";
code_ += " flatbuffers::root::<{{STRUCT_TY}}>(buf)"; code_ += " ::flatbuffers::root::<{{STRUCT_TY}}>(buf)";
code_ += "}"; code_ += "}";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += "/// Verifies that a buffer of bytes contains a size prefixed"; code_ += "/// Verifies that a buffer of bytes contains a size prefixed";
@@ -2474,8 +2477,8 @@ class RustGenerator : public BaseGenerator {
code_ += code_ +=
"pub fn size_prefixed_root_as_{{STRUCT_FN}}" "pub fn size_prefixed_root_as_{{STRUCT_FN}}"
"(buf: &[u8]) -> Result<{{STRUCT_TY}}<'_>, " "(buf: &[u8]) -> Result<{{STRUCT_TY}}<'_>, "
"flatbuffers::InvalidFlatbuffer> {"; "::flatbuffers::InvalidFlatbuffer> {";
code_ += " flatbuffers::size_prefixed_root::<{{STRUCT_TY}}>(buf)"; code_ += " ::flatbuffers::size_prefixed_root::<{{STRUCT_TY}}>(buf)";
code_ += "}"; code_ += "}";
// Verifier with options root fns. // Verifier with options root fns.
code_ += "#[inline]"; code_ += "#[inline]";
@@ -2486,12 +2489,12 @@ class RustGenerator : public BaseGenerator {
code_ += "/// previous, unchecked, behavior use"; code_ += "/// previous, unchecked, behavior use";
code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`."; code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`.";
code_ += "pub fn root_as_{{STRUCT_FN}}_with_opts<'b, 'o>("; code_ += "pub fn root_as_{{STRUCT_FN}}_with_opts<'b, 'o>(";
code_ += " opts: &'o flatbuffers::VerifierOptions,"; code_ += " opts: &'o ::flatbuffers::VerifierOptions,";
code_ += " buf: &'b [u8],"; code_ += " buf: &'b [u8],";
code_ += code_ +=
") -> Result<{{STRUCT_TY}}<'b>, flatbuffers::InvalidFlatbuffer>" ") -> Result<{{STRUCT_TY}}<'b>, ::flatbuffers::InvalidFlatbuffer>"
" {"; " {";
code_ += " flatbuffers::root_with_opts::<{{STRUCT_TY}}<'b>>(opts, buf)"; code_ += " ::flatbuffers::root_with_opts::<{{STRUCT_TY}}<'b>>(opts, buf)";
code_ += "}"; code_ += "}";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += "/// Verifies, with the given verifier options, that a buffer of"; code_ += "/// Verifies, with the given verifier options, that a buffer of";
@@ -2503,13 +2506,13 @@ class RustGenerator : public BaseGenerator {
code_ += code_ +=
"pub fn size_prefixed_root_as_{{STRUCT_FN}}_with_opts" "pub fn size_prefixed_root_as_{{STRUCT_FN}}_with_opts"
"<'b, 'o>("; "<'b, 'o>(";
code_ += " opts: &'o flatbuffers::VerifierOptions,"; code_ += " opts: &'o ::flatbuffers::VerifierOptions,";
code_ += " buf: &'b [u8],"; code_ += " buf: &'b [u8],";
code_ += code_ +=
") -> Result<{{STRUCT_TY}}<'b>, flatbuffers::InvalidFlatbuffer>" ") -> Result<{{STRUCT_TY}}<'b>, ::flatbuffers::InvalidFlatbuffer>"
" {"; " {";
code_ += code_ +=
" flatbuffers::size_prefixed_root_with_opts::<{{STRUCT_TY}}" " ::flatbuffers::size_prefixed_root_with_opts::<{{STRUCT_TY}}"
"<'b>>(opts, buf)"; "<'b>>(opts, buf)";
code_ += "}"; code_ += "}";
// Unchecked root fns. // Unchecked root fns.
@@ -2524,7 +2527,7 @@ class RustGenerator : public BaseGenerator {
code_ += code_ +=
"pub unsafe fn root_as_{{STRUCT_FN}}_unchecked" "pub unsafe fn root_as_{{STRUCT_FN}}_unchecked"
"(buf: &[u8]) -> {{STRUCT_TY}}<'_> {"; "(buf: &[u8]) -> {{STRUCT_TY}}<'_> {";
code_ += " unsafe { flatbuffers::root_unchecked::<{{STRUCT_TY}}>(buf) }"; code_ += " unsafe { ::flatbuffers::root_unchecked::<{{STRUCT_TY}}>(buf) }";
code_ += "}"; code_ += "}";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += code_ +=
@@ -2538,7 +2541,8 @@ class RustGenerator : public BaseGenerator {
"pub unsafe fn size_prefixed_root_as_{{STRUCT_FN}}" "pub unsafe fn size_prefixed_root_as_{{STRUCT_FN}}"
"_unchecked(buf: &[u8]) -> {{STRUCT_TY}}<'_> {"; "_unchecked(buf: &[u8]) -> {{STRUCT_TY}}<'_> {";
code_ += code_ +=
" unsafe { flatbuffers::size_prefixed_root_unchecked::<{{STRUCT_TY}}>" " unsafe { "
"::flatbuffers::size_prefixed_root_unchecked::<{{STRUCT_TY}}>"
"(buf) }"; "(buf) }";
code_ += "}"; code_ += "}";
@@ -2553,14 +2557,14 @@ class RustGenerator : public BaseGenerator {
code_ += "#[inline]"; code_ += "#[inline]";
code_ += "pub fn {{STRUCT_FN}}_buffer_has_identifier\\"; code_ += "pub fn {{STRUCT_FN}}_buffer_has_identifier\\";
code_ += "(buf: &[u8]) -> bool {"; code_ += "(buf: &[u8]) -> bool {";
code_ += " flatbuffers::buffer_has_identifier(buf, \\"; code_ += " ::flatbuffers::buffer_has_identifier(buf, \\";
code_ += "{{STRUCT_CONST}}_IDENTIFIER, false)"; code_ += "{{STRUCT_CONST}}_IDENTIFIER, false)";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += "pub fn {{STRUCT_FN}}_size_prefixed\\"; code_ += "pub fn {{STRUCT_FN}}_size_prefixed\\";
code_ += "_buffer_has_identifier(buf: &[u8]) -> bool {"; code_ += "_buffer_has_identifier(buf: &[u8]) -> bool {";
code_ += " flatbuffers::buffer_has_identifier(buf, \\"; code_ += " ::flatbuffers::buffer_has_identifier(buf, \\";
code_ += "{{STRUCT_CONST}}_IDENTIFIER, true)"; code_ += "{{STRUCT_CONST}}_IDENTIFIER, true)";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
@@ -2577,9 +2581,9 @@ class RustGenerator : public BaseGenerator {
code_ += "#[inline]"; code_ += "#[inline]";
code_ += code_ +=
"pub fn finish_{{STRUCT_FN}}_buffer<'a, 'b, A: " "pub fn finish_{{STRUCT_FN}}_buffer<'a, 'b, A: "
"flatbuffers::Allocator + 'a>("; "::flatbuffers::Allocator + 'a>(";
code_ += " fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,"; code_ += " fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,";
code_ += " root: flatbuffers::WIPOffset<{{STRUCT_TY}}<'a>>) {"; code_ += " root: ::flatbuffers::WIPOffset<{{STRUCT_TY}}<'a>>) {";
if (parser_.file_identifier_.length()) { if (parser_.file_identifier_.length()) {
code_ += " fbb.finish(root, Some({{STRUCT_CONST}}_IDENTIFIER));"; code_ += " fbb.finish(root, Some({{STRUCT_CONST}}_IDENTIFIER));";
} else { } else {
@@ -2590,9 +2594,9 @@ class RustGenerator : public BaseGenerator {
code_ += "#[inline]"; code_ += "#[inline]";
code_ += code_ +=
"pub fn finish_size_prefixed_{{STRUCT_FN}}_buffer" "pub fn finish_size_prefixed_{{STRUCT_FN}}_buffer"
"<'a, 'b, A: flatbuffers::Allocator + 'a>(" "<'a, 'b, A: ::flatbuffers::Allocator + 'a>("
"fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, " "fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, "
"root: flatbuffers::WIPOffset<{{STRUCT_TY}}<'a>>) {"; "root: ::flatbuffers::WIPOffset<{{STRUCT_TY}}<'a>>) {";
if (parser_.file_identifier_.length()) { if (parser_.file_identifier_.length()) {
code_ += code_ +=
" fbb.finish_size_prefixed(root, " " fbb.finish_size_prefixed(root, "
@@ -2677,10 +2681,10 @@ class RustGenerator : public BaseGenerator {
code_ += "}"; code_ += "}";
// Debug for structs. // Debug for structs.
code_ += "impl core::fmt::Debug for {{STRUCT_TY}} {"; code_ += "impl ::core::fmt::Debug for {{STRUCT_TY}} {";
code_ += code_ +=
" fn fmt(&self, f: &mut core::fmt::Formatter" " fn fmt(&self, f: &mut ::core::fmt::Formatter"
") -> core::fmt::Result {"; ") -> ::core::fmt::Result {";
code_ += " f.debug_struct(\"{{STRUCT_TY}}\")"; code_ += " f.debug_struct(\"{{STRUCT_TY}}\")";
ForAllStructFields(struct_def, [&](const FieldDef& unused) { ForAllStructFields(struct_def, [&](const FieldDef& unused) {
(void)unused; (void)unused;
@@ -2694,48 +2698,47 @@ class RustGenerator : public BaseGenerator {
// Generate impls for SafeSliceAccess (because all structs are endian-safe), // Generate impls for SafeSliceAccess (because all structs are endian-safe),
// Follow for the value type, Follow for the reference type, Push for the // Follow for the value type, Follow for the reference type, Push for the
// value type, and Push for the reference type. // value type, and Push for the reference type.
code_ += "impl flatbuffers::SimpleToVerifyInSlice for {{STRUCT_TY}} {}"; code_ += "impl ::flatbuffers::SimpleToVerifyInSlice for {{STRUCT_TY}} {}";
code_ += "impl<'a> flatbuffers::Follow<'a> for {{STRUCT_TY}} {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{STRUCT_TY}} {";
code_ += " type Inner = &'a {{STRUCT_TY}};"; code_ += " type Inner = &'a {{STRUCT_TY}};";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += " unsafe { <&'a {{STRUCT_TY}}>::follow(buf, loc) }"; code_ += " unsafe { <&'a {{STRUCT_TY}}>::follow(buf, loc) }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "impl<'a> flatbuffers::Follow<'a> for &'a {{STRUCT_TY}} {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for &'a {{STRUCT_TY}} {";
code_ += " type Inner = &'a {{STRUCT_TY}};"; code_ += " type Inner = &'a {{STRUCT_TY}};";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += code_ +=
" unsafe { flatbuffers::follow_cast_ref::<{{STRUCT_TY}}>(buf, loc) " " unsafe { ::flatbuffers::follow_cast_ref::<{{STRUCT_TY}}>(buf, "
"}"; "loc) }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "impl<'b> flatbuffers::Push for {{STRUCT_TY}} {"; code_ += "impl<'b> ::flatbuffers::Push for {{STRUCT_TY}} {";
code_ += " type Output = {{STRUCT_TY}};"; code_ += " type Output = {{STRUCT_TY}};";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {"; code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {";
code_ += code_ +=
" let src = unsafe { ::core::slice::from_raw_parts(self as " " let src = unsafe { ::core::slice::from_raw_parts(self as "
"*const " "*const "
"{{STRUCT_TY}} as *const u8, <Self as flatbuffers::Push>::size()) };"; "{{STRUCT_TY}} as *const u8, <Self as ::flatbuffers::Push>::size()) };";
code_ += " dst.copy_from_slice(src);"; code_ += " dst.copy_from_slice(src);";
code_ += " }"; code_ += " }";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn alignment() -> flatbuffers::PushAlignment {"; code_ += " fn alignment() -> ::flatbuffers::PushAlignment {";
code_ += " flatbuffers::PushAlignment::new({{ALIGN}})"; code_ += " ::flatbuffers::PushAlignment::new({{ALIGN}})";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
// Generate verifier: Structs are simple so presence and alignment are // Generate verifier: Structs are simple so presence and alignment are
// all that need to be checked. // all that need to be checked.
code_ += "impl<'a> flatbuffers::Verifiable for {{STRUCT_TY}} {"; code_ += "impl<'a> ::flatbuffers::Verifiable for {{STRUCT_TY}} {";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn run_verifier("; code_ += " fn run_verifier(";
code_ += " v: &mut flatbuffers::Verifier, pos: usize"; code_ += " v: &mut ::flatbuffers::Verifier, pos: usize";
code_ += " ) -> Result<(), flatbuffers::InvalidFlatbuffer> {"; code_ += " ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {";
code_ += " use self::flatbuffers::Verifiable;";
code_ += " v.in_buffer::<Self>(pos)"; code_ += " v.in_buffer::<Self>(pos)";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
@@ -2812,28 +2815,31 @@ class RustGenerator : public BaseGenerator {
code_.SetValue("ARRAY_ITEM", GetTypeGet(field.value.type.VectorType())); code_.SetValue("ARRAY_ITEM", GetTypeGet(field.value.type.VectorType()));
code_ += code_ +=
"pub fn {{FIELD}}(&'a self) -> " "pub fn {{FIELD}}(&'a self) -> "
"flatbuffers::Array<'a, {{ARRAY_ITEM}}, {{ARRAY_SIZE}}> {"; "::flatbuffers::Array<'a, {{ARRAY_ITEM}}, {{ARRAY_SIZE}}> {";
code_ += " // Safety:"; code_ += " // Safety:";
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid array in this slot"; code_ += " // Which contains a valid array in this slot";
code_ += " use ::flatbuffers::Follow;";
code_ += code_ +=
" unsafe { flatbuffers::Array::follow(&self.0, {{FIELD_OFFSET}}) " " unsafe { ::flatbuffers::Array::follow(&self.0, "
"{{FIELD_OFFSET}}) "
"}"; "}";
} else { } else {
code_ += "pub fn {{FIELD}}(&self) -> {{FIELD_TYPE}} {"; code_ += "pub fn {{FIELD}}(&self) -> {{FIELD_TYPE}} {";
code_ += code_ +=
" let mut mem = core::mem::MaybeUninit::" " let mut mem = ::core::mem::MaybeUninit::"
"<<{{FIELD_TYPE}} as EndianScalar>::Scalar>::uninit();"; "<<{{FIELD_TYPE}} as "
"::flatbuffers::EndianScalar>::Scalar>::uninit();";
code_ += " // Safety:"; code_ += " // Safety:";
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid value in this slot"; code_ += " // Which contains a valid value in this slot";
code_ += " EndianScalar::from_little_endian(unsafe {"; code_ += " ::flatbuffers::EndianScalar::from_little_endian(unsafe {";
code_ += " core::ptr::copy_nonoverlapping("; code_ += " ::core::ptr::copy_nonoverlapping(";
code_ += " self.0[{{FIELD_OFFSET}}..].as_ptr(),"; code_ += " self.0[{{FIELD_OFFSET}}..].as_ptr(),";
code_ += " mem.as_mut_ptr() as *mut u8,"; code_ += " mem.as_mut_ptr() as *mut u8,";
code_ += code_ +=
" core::mem::size_of::<<{{FIELD_TYPE}} as " " ::core::mem::size_of::<<{{FIELD_TYPE}} as "
"EndianScalar>::Scalar>(),"; "::flatbuffers::EndianScalar>::Scalar>(),";
code_ += " );"; code_ += " );";
code_ += " mem.assume_init()"; code_ += " mem.assume_init()";
code_ += " })"; code_ += " })";
@@ -2861,7 +2867,7 @@ class RustGenerator : public BaseGenerator {
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid array in this slot"; code_ += " // Which contains a valid array in this slot";
code_ += code_ +=
" unsafe { flatbuffers::emplace_scalar_array(&mut self.0, " " unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, "
"{{FIELD_OFFSET}}, items) };"; "{{FIELD_OFFSET}}, items) };";
} else { } else {
code_.SetValue("FIELD_SIZE", code_.SetValue("FIELD_SIZE",
@@ -2871,7 +2877,7 @@ class RustGenerator : public BaseGenerator {
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid array in this slot"; code_ += " // Which contains a valid array in this slot";
code_ += " unsafe {"; code_ += " unsafe {";
code_ += " core::ptr::copy("; code_ += " ::core::ptr::copy(";
code_ += " x.as_ptr() as *const u8,"; code_ += " x.as_ptr() as *const u8,";
code_ += " self.0.as_mut_ptr().add({{FIELD_OFFSET}}),"; code_ += " self.0.as_mut_ptr().add({{FIELD_OFFSET}}),";
code_ += " {{FIELD_SIZE}},"; code_ += " {{FIELD_SIZE}},";
@@ -2880,17 +2886,18 @@ class RustGenerator : public BaseGenerator {
} }
} else { } else {
code_ += "pub fn set_{{FIELD}}(&mut self, x: {{FIELD_TYPE}}) {"; code_ += "pub fn set_{{FIELD}}(&mut self, x: {{FIELD_TYPE}}) {";
code_ += " let x_le = x.to_little_endian();"; code_ +=
" let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);";
code_ += " // Safety:"; code_ += " // Safety:";
code_ += " // Created from a valid Table for this object"; code_ += " // Created from a valid Table for this object";
code_ += " // Which contains a valid value in this slot"; code_ += " // Which contains a valid value in this slot";
code_ += " unsafe {"; code_ += " unsafe {";
code_ += " core::ptr::copy_nonoverlapping("; code_ += " ::core::ptr::copy_nonoverlapping(";
code_ += " &x_le as *const _ as *const u8,"; code_ += " &x_le as *const _ as *const u8,";
code_ += " self.0[{{FIELD_OFFSET}}..].as_mut_ptr(),"; code_ += " self.0[{{FIELD_OFFSET}}..].as_mut_ptr(),";
code_ += code_ +=
" core::mem::size_of::<<{{FIELD_TYPE}} as " " ::core::mem::size_of::<<{{FIELD_TYPE}} as "
"EndianScalar>::Scalar>(),"; "::flatbuffers::EndianScalar>::Scalar>(),";
code_ += " );"; code_ += " );";
code_ += " }"; code_ += " }";
} }
@@ -2912,7 +2919,7 @@ class RustGenerator : public BaseGenerator {
if (GetFullType(field.value.type) == ftArrayOfStruct) { if (GetFullType(field.value.type) == ftArrayOfStruct) {
code_ += code_ +=
" {{FIELD}}: { let {{FIELD}} = " " {{FIELD}}: { let {{FIELD}} = "
"self.{{FIELD}}(); flatbuffers::array_init(|i| " "self.{{FIELD}}(); ::flatbuffers::array_init(|i| "
"{{FIELD}}.get(i).unpack()) },"; "{{FIELD}}.get(i).unpack()) },";
} else { } else {
code_ += " {{FIELD}}: self.{{FIELD}}().into(),"; code_ += " {{FIELD}}: self.{{FIELD}}().into(),";
@@ -2950,7 +2957,7 @@ class RustGenerator : public BaseGenerator {
} else if (IsArray(field.value.type)) { } else if (IsArray(field.value.type)) {
if (GetFullType(field.value.type) == ftArrayOfStruct) { if (GetFullType(field.value.type) == ftArrayOfStruct) {
code_ += code_ +=
" &flatbuffers::array_init(|i| " " &::flatbuffers::array_init(|i| "
"self.{{FIELD}}[i].pack()),"; "self.{{FIELD}}[i].pack()),";
} else { } else {
code_ += " &self.{{FIELD}},"; code_ += " &self.{{FIELD}},";
@@ -2991,9 +2998,6 @@ class RustGenerator : public BaseGenerator {
} }
} }
} }
code_ += indent + "use core::mem;";
code_ += indent + "use core::cmp::Ordering;";
code_ += "";
if (parser_.opts.rust_serialize) { if (parser_.opts.rust_serialize) {
code_ += indent + "extern crate serde;"; code_ += indent + "extern crate serde;";
code_ += code_ +=
@@ -3001,8 +3005,6 @@ class RustGenerator : public BaseGenerator {
"use self::serde::ser::{Serialize, Serializer, SerializeStruct};"; "use self::serde::ser::{Serialize, Serializer, SerializeStruct};";
code_ += ""; code_ += "";
} }
code_ += indent + "extern crate flatbuffers;";
code_ += indent + "use self::flatbuffers::{EndianScalar, Follow};";
} }
// Set up the correct namespace. This opens a namespace if the current // Set up the correct namespace. This opens a namespace if the current

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct ArrayStruct, aligned to 8 // struct ArrayStruct, aligned to 8
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for ArrayStruct {
Self([0; 160]) Self([0; 160])
} }
} }
impl core::fmt::Debug for ArrayStruct { impl ::core::fmt::Debug for ArrayStruct {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("ArrayStruct") f.debug_struct("ArrayStruct")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -31,40 +24,39 @@ impl core::fmt::Debug for ArrayStruct {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for ArrayStruct {} impl ::flatbuffers::SimpleToVerifyInSlice for ArrayStruct {}
impl<'a> flatbuffers::Follow<'a> for ArrayStruct { impl<'a> ::flatbuffers::Follow<'a> for ArrayStruct {
type Inner = &'a ArrayStruct; type Inner = &'a ArrayStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a ArrayStruct>::follow(buf, loc) } unsafe { <&'a ArrayStruct>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a ArrayStruct { impl<'a> ::flatbuffers::Follow<'a> for &'a ArrayStruct {
type Inner = &'a ArrayStruct; type Inner = &'a ArrayStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<ArrayStruct>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<ArrayStruct>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for ArrayStruct { impl<'b> ::flatbuffers::Push for ArrayStruct {
type Output = ArrayStruct; type Output = ArrayStruct;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, <Self as flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
} }
} }
impl<'a> flatbuffers::Verifiable for ArrayStruct { impl<'a> ::flatbuffers::Verifiable for ArrayStruct {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -94,82 +86,84 @@ impl<'a> ArrayStruct {
} }
pub fn a(&self) -> f32 { pub fn a(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: f32) { pub fn set_a(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn b(&'a self) -> flatbuffers::Array<'a, i32, 15> { pub fn b(&'a self) -> ::flatbuffers::Array<'a, i32, 15> {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::Array::follow(&self.0, 4) } use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 4) }
} }
pub fn set_b(&mut self, items: &[i32; 15]) { pub fn set_b(&mut self, items: &[i32; 15]) {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 4, items) }; unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 4, items) };
} }
pub fn c(&self) -> i8 { pub fn c(&self) -> i8 {
let mut mem = core::mem::MaybeUninit::<<i8 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i8 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[64..].as_ptr(), self.0[64..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_c(&mut self, x: i8) { pub fn set_c(&mut self, x: i8) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[64..].as_mut_ptr(), self.0[64..].as_mut_ptr(),
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn d(&'a self) -> flatbuffers::Array<'a, NestedStruct, 2> { pub fn d(&'a self) -> ::flatbuffers::Array<'a, NestedStruct, 2> {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::Array::follow(&self.0, 72) } use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 72) }
} }
pub fn set_d(&mut self, x: &[NestedStruct; 2]) { pub fn set_d(&mut self, x: &[NestedStruct; 2]) {
@@ -177,7 +171,7 @@ impl<'a> ArrayStruct {
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { unsafe {
core::ptr::copy( ::core::ptr::copy(
x.as_ptr() as *const u8, x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(72), self.0.as_mut_ptr().add(72),
64, 64,
@@ -186,46 +180,47 @@ impl<'a> ArrayStruct {
} }
pub fn e(&self) -> i32 { pub fn e(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[136..].as_ptr(), self.0[136..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_e(&mut self, x: i32) { pub fn set_e(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[136..].as_mut_ptr(), self.0[136..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn f(&'a self) -> flatbuffers::Array<'a, i64, 2> { pub fn f(&'a self) -> ::flatbuffers::Array<'a, i64, 2> {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::Array::follow(&self.0, 144) } use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 144) }
} }
pub fn set_f(&mut self, items: &[i64; 2]) { pub fn set_f(&mut self, items: &[i64; 2]) {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 144, items) }; unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 144, items) };
} }
pub fn unpack(&self) -> ArrayStructT { pub fn unpack(&self) -> ArrayStructT {
@@ -233,7 +228,7 @@ impl<'a> ArrayStruct {
a: self.a(), a: self.a(),
b: self.b().into(), b: self.b().into(),
c: self.c(), c: self.c(),
d: { let d = self.d(); flatbuffers::array_init(|i| d.get(i).unpack()) }, d: { let d = self.d(); ::flatbuffers::array_init(|i| d.get(i).unpack()) },
e: self.e(), e: self.e(),
f: self.f().into(), f: self.f().into(),
} }
@@ -255,7 +250,7 @@ impl ArrayStructT {
self.a, self.a,
&self.b, &self.b,
self.c, self.c,
&flatbuffers::array_init(|i| self.d[i].pack()), &::flatbuffers::array_init(|i| self.d[i].pack()),
self.e, self.e,
&self.f, &self.f,
) )

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum ArrayTableOffset {} pub enum ArrayTableOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct ArrayTable<'a> { pub struct ArrayTable<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for ArrayTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for ArrayTable<'a> {
type Inner = ArrayTable<'a>; type Inner = ArrayTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> ArrayTable<'a> { impl<'a> ArrayTable<'a> {
pub const VT_A: flatbuffers::VOffsetT = 4; pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.ArrayTable" "MyGame.Example.ArrayTable"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ArrayTable { _tab: table } ArrayTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ArrayTableArgs<'args> args: &'args ArrayTableArgs<'args>
) -> flatbuffers::WIPOffset<ArrayTable<'bldr>> { ) -> ::flatbuffers::WIPOffset<ArrayTable<'bldr>> {
let mut builder = ArrayTableBuilder::new(_fbb); let mut builder = ArrayTableBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); } if let Some(x) = args.a { builder.add_a(x); }
builder.finish() builder.finish()
@@ -63,12 +56,11 @@ impl<'a> ArrayTable<'a> {
} }
} }
impl flatbuffers::Verifiable for ArrayTable<'_> { impl ::flatbuffers::Verifiable for ArrayTable<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<ArrayStruct>("a", Self::VT_A, false)? .visit_field::<ArrayStruct>("a", Self::VT_A, false)?
.finish(); .finish();
@@ -87,17 +79,17 @@ impl<'a> Default for ArrayTableArgs<'a> {
} }
} }
pub struct ArrayTableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct ArrayTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: &ArrayStruct) { pub fn add_a(&mut self, a: &ArrayStruct) {
self.fbb_.push_slot_always::<&ArrayStruct>(ArrayTable::VT_A, a); self.fbb_.push_slot_always::<&ArrayStruct>(ArrayTable::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
ArrayTableBuilder { ArrayTableBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<ArrayTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<ArrayTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for ArrayTable<'_> { impl ::core::fmt::Debug for ArrayTable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("ArrayTable"); let mut ds = f.debug_struct("ArrayTable");
ds.field("a", &self.a()); ds.field("a", &self.a());
ds.finish() ds.finish()
@@ -131,10 +123,10 @@ impl Default for ArrayTableT {
} }
} }
impl ArrayTableT { impl ArrayTableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<ArrayTable<'b>> { ) -> ::flatbuffers::WIPOffset<ArrayTable<'b>> {
let a_tmp = self.a.as_ref().map(|x| x.pack()); let a_tmp = self.a.as_ref().map(|x| x.pack());
let a = a_tmp.as_ref(); let a = a_tmp.as_ref();
ArrayTable::create(_fbb, &ArrayTableArgs{ ArrayTable::create(_fbb, &ArrayTableArgs{
@@ -149,8 +141,8 @@ impl ArrayTableT {
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`. /// `root_as_array_table_unchecked`.
pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, flatbuffers::InvalidFlatbuffer> { pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<ArrayTable>(buf) ::flatbuffers::root::<ArrayTable>(buf)
} }
#[inline] #[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
@@ -159,8 +151,8 @@ pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, flatbuffers::In
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_array_table_unchecked`. /// `size_prefixed_root_as_array_table_unchecked`.
pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<ArrayTable>(buf) ::flatbuffers::size_prefixed_root::<ArrayTable>(buf)
} }
#[inline] #[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
@@ -170,10 +162,10 @@ pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, f
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`. /// `root_as_array_table_unchecked`.
pub fn root_as_array_table_with_opts<'b, 'o>( pub fn root_as_array_table_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ArrayTable<'b>, flatbuffers::InvalidFlatbuffer> { ) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<ArrayTable<'b>>(opts, buf) ::flatbuffers::root_with_opts::<ArrayTable<'b>>(opts, buf)
} }
#[inline] #[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
@@ -183,47 +175,47 @@ pub fn root_as_array_table_with_opts<'b, 'o>(
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`. /// `root_as_array_table_unchecked`.
pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>( pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ArrayTable<'b>, flatbuffers::InvalidFlatbuffer> { ) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<ArrayTable<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<ArrayTable<'b>>(opts, buf)
} }
#[inline] #[inline]
/// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it. /// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `ArrayTable`. /// Callers must trust the given bytes do indeed contain a valid `ArrayTable`.
pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> { pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
unsafe { flatbuffers::root_unchecked::<ArrayTable>(buf) } unsafe { ::flatbuffers::root_unchecked::<ArrayTable>(buf) }
} }
#[inline] #[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`.
pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> { pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
unsafe { flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) }
} }
pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT"; pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT";
#[inline] #[inline]
pub fn array_table_buffer_has_identifier(buf: &[u8]) -> bool { pub fn array_table_buffer_has_identifier(buf: &[u8]) -> bool {
flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, false) ::flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, false)
} }
#[inline] #[inline]
pub fn array_table_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool { pub fn array_table_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, true) ::flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, true)
} }
pub const ARRAY_TABLE_EXTENSION: &str = "mon"; pub const ARRAY_TABLE_EXTENSION: &str = "mon";
#[inline] #[inline]
pub fn finish_array_table_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( pub fn finish_array_table_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<ArrayTable<'a>>) { root: ::flatbuffers::WIPOffset<ArrayTable<'a>>) {
fbb.finish(root, Some(ARRAY_TABLE_IDENTIFIER)); fbb.finish(root, Some(ARRAY_TABLE_IDENTIFIER));
} }
#[inline] #[inline]
pub fn finish_size_prefixed_array_table_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<ArrayTable<'a>>) { pub fn finish_size_prefixed_array_table_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<ArrayTable<'a>>) {
fbb.finish_size_prefixed(root, Some(ARRAY_TABLE_IDENTIFIER)); fbb.finish_size_prefixed(root, Some(ARRAY_TABLE_IDENTIFIER));
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct NestedStruct, aligned to 8 // struct NestedStruct, aligned to 8
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for NestedStruct {
Self([0; 32]) Self([0; 32])
} }
} }
impl core::fmt::Debug for NestedStruct { impl ::core::fmt::Debug for NestedStruct {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("NestedStruct") f.debug_struct("NestedStruct")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -29,40 +22,39 @@ impl core::fmt::Debug for NestedStruct {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for NestedStruct {} impl ::flatbuffers::SimpleToVerifyInSlice for NestedStruct {}
impl<'a> flatbuffers::Follow<'a> for NestedStruct { impl<'a> ::flatbuffers::Follow<'a> for NestedStruct {
type Inner = &'a NestedStruct; type Inner = &'a NestedStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a NestedStruct>::follow(buf, loc) } unsafe { <&'a NestedStruct>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a NestedStruct { impl<'a> ::flatbuffers::Follow<'a> for &'a NestedStruct {
type Inner = &'a NestedStruct; type Inner = &'a NestedStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<NestedStruct>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<NestedStruct>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for NestedStruct { impl<'b> ::flatbuffers::Push for NestedStruct {
type Output = NestedStruct; type Output = NestedStruct;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, <Self as flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
} }
} }
impl<'a> flatbuffers::Verifiable for NestedStruct { impl<'a> ::flatbuffers::Verifiable for NestedStruct {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -87,54 +79,56 @@ impl<'a> NestedStruct {
"MyGame.Example.NestedStruct" "MyGame.Example.NestedStruct"
} }
pub fn a(&'a self) -> flatbuffers::Array<'a, i32, 2> { pub fn a(&'a self) -> ::flatbuffers::Array<'a, i32, 2> {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::Array::follow(&self.0, 0) } use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 0) }
} }
pub fn set_a(&mut self, items: &[i32; 2]) { pub fn set_a(&mut self, items: &[i32; 2]) {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) }; unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
} }
pub fn b(&self) -> TestEnum { pub fn b(&self) -> TestEnum {
let mut mem = core::mem::MaybeUninit::<<TestEnum as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(), self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<TestEnum as EndianScalar>::Scalar>(), ::core::mem::size_of::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_b(&mut self, x: TestEnum) { pub fn set_b(&mut self, x: TestEnum) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[8..].as_mut_ptr(), self.0[8..].as_mut_ptr(),
core::mem::size_of::<<TestEnum as EndianScalar>::Scalar>(), ::core::mem::size_of::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn c(&'a self) -> flatbuffers::Array<'a, TestEnum, 2> { pub fn c(&'a self) -> ::flatbuffers::Array<'a, TestEnum, 2> {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::Array::follow(&self.0, 9) } use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 9) }
} }
pub fn set_c(&mut self, x: &[TestEnum; 2]) { pub fn set_c(&mut self, x: &[TestEnum; 2]) {
@@ -142,7 +136,7 @@ impl<'a> NestedStruct {
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { unsafe {
core::ptr::copy( ::core::ptr::copy(
x.as_ptr() as *const u8, x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(9), self.0.as_mut_ptr().add(9),
2, 2,
@@ -150,18 +144,19 @@ impl<'a> NestedStruct {
} }
} }
pub fn d(&'a self) -> flatbuffers::Array<'a, i64, 2> { pub fn d(&'a self) -> ::flatbuffers::Array<'a, i64, 2> {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::Array::follow(&self.0, 16) } use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 16) }
} }
pub fn set_d(&mut self, items: &[i64; 2]) { pub fn set_d(&mut self, items: &[i64; 2]) {
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid array in this slot // Which contains a valid array in this slot
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 16, items) }; unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 16, items) };
} }
pub fn unpack(&self) -> NestedStructT { pub fn unpack(&self) -> NestedStructT {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_TEST_ENUM: i8 = 0; pub const ENUM_MIN_TEST_ENUM: i8 = 0;
@@ -47,8 +40,8 @@ impl TestEnum {
} }
} }
} }
impl core::fmt::Debug for TestEnum { impl ::core::fmt::Debug for TestEnum {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for TestEnum {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for TestEnum { impl<'a> ::flatbuffers::Follow<'a> for TestEnum {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for TestEnum { impl ::flatbuffers::Push for TestEnum {
type Output = TestEnum; type Output = TestEnum;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for TestEnum { impl ::flatbuffers::EndianScalar for TestEnum {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for TestEnum {
} }
} }
impl<'a> flatbuffers::Verifiable for TestEnum { impl<'a> ::flatbuffers::Verifiable for TestEnum {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for TestEnum {} impl ::flatbuffers::SimpleToVerifyInSlice for TestEnum {}

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -39,8 +32,8 @@ impl FromInclude {
} }
} }
} }
impl core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -48,24 +41,24 @@ impl core::fmt::Debug for FromInclude {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
@@ -79,14 +72,13 @@ impl flatbuffers::EndianScalar for FromInclude {
} }
} }
impl<'a> flatbuffers::Verifiable for FromInclude { impl<'a> ::flatbuffers::Verifiable for FromInclude {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i64::run_verifier(v, pos) i64::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for FromInclude {} impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableBOffset {} pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableB<'a> { impl<'a> TableB<'a> {
pub const VT_A: flatbuffers::VOffsetT = 4; pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB" "MyGame.OtherNameSpace.TableB"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args> args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb); let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); } if let Some(x) = args.a { builder.add_a(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT { pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| { let a = self.a().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableBT { TableBT {
a, a,
@@ -59,24 +52,23 @@ impl<'a> TableB<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
} }
} }
impl flatbuffers::Verifiable for TableB<'_> { impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableBArgs<'a> {
} }
} }
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableBBuilder { TableBBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableB<'_> { impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB"); let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a()); ds.field("a", &self.a());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableBT {
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> { ) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{ let a = self.a.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,48 +11,47 @@ impl Default for Unused {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
.field("a", &self.a()) .field("a", &self.a())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Unused { impl<'a> ::flatbuffers::Verifiable for Unused {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -79,30 +71,30 @@ impl<'a> Unused {
} }
pub fn a(&self) -> i32 { pub fn a(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i32) { pub fn set_a(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableAOffset {} pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableA<'a> { impl<'a> TableA<'a> {
pub const VT_B: flatbuffers::VOffsetT = 4; pub const VT_B: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"TableA" "TableA"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableAArgs<'args> args: &'args TableAArgs<'args>
) -> flatbuffers::WIPOffset<TableA<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableA<'bldr>> {
let mut builder = TableABuilder::new(_fbb); let mut builder = TableABuilder::new(_fbb);
if let Some(x) = args.b { builder.add_b(x); } if let Some(x) = args.b { builder.add_b(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableA<'a> {
pub fn unpack(&self) -> TableAT { pub fn unpack(&self) -> TableAT {
let b = self.b().map(|x| { let b = self.b().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableAT { TableAT {
b, b,
@@ -59,24 +52,23 @@ impl<'a> TableA<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
} }
} }
impl flatbuffers::Verifiable for TableA<'_> { impl ::flatbuffers::Verifiable for TableA<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)? .visit_field::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableAArgs<'a> {
} }
} }
pub struct TableABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableABuilder { TableABuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableA<'_> { impl ::core::fmt::Debug for TableA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableA"); let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b()); ds.field("b", &self.b());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableA<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableAT {
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableA<'b>> { ) -> ::flatbuffers::WIPOffset<TableA<'b>> {
let b = self.b.as_ref().map(|x|{ let b = self.b.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -39,8 +32,8 @@ impl FromInclude {
} }
} }
} }
impl core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -48,24 +41,24 @@ impl core::fmt::Debug for FromInclude {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
@@ -79,14 +72,13 @@ impl flatbuffers::EndianScalar for FromInclude {
} }
} }
impl<'a> flatbuffers::Verifiable for FromInclude { impl<'a> ::flatbuffers::Verifiable for FromInclude {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i64::run_verifier(v, pos) i64::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for FromInclude {} impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableBOffset {} pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableB<'a> { impl<'a> TableB<'a> {
pub const VT_A: flatbuffers::VOffsetT = 4; pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB" "MyGame.OtherNameSpace.TableB"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args> args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb); let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); } if let Some(x) = args.a { builder.add_a(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT { pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| { let a = self.a().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableBT { TableBT {
a, a,
@@ -59,24 +52,23 @@ impl<'a> TableB<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
} }
} }
impl flatbuffers::Verifiable for TableB<'_> { impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableBArgs<'a> {
} }
} }
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableBBuilder { TableBBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableB<'_> { impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB"); let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a()); ds.field("a", &self.a());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableBT {
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> { ) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{ let a = self.a.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,48 +11,47 @@ impl Default for Unused {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
.field("a", &self.a()) .field("a", &self.a())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Unused { impl<'a> ::flatbuffers::Verifiable for Unused {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -79,30 +71,30 @@ impl<'a> Unused {
} }
pub fn a(&self) -> i32 { pub fn a(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i32) { pub fn set_a(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableAOffset {} pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableA<'a> { impl<'a> TableA<'a> {
pub const VT_B: flatbuffers::VOffsetT = 4; pub const VT_B: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"TableA" "TableA"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableAArgs<'args> args: &'args TableAArgs<'args>
) -> flatbuffers::WIPOffset<TableA<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableA<'bldr>> {
let mut builder = TableABuilder::new(_fbb); let mut builder = TableABuilder::new(_fbb);
if let Some(x) = args.b { builder.add_b(x); } if let Some(x) = args.b { builder.add_b(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableA<'a> {
pub fn unpack(&self) -> TableAT { pub fn unpack(&self) -> TableAT {
let b = self.b().map(|x| { let b = self.b().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableAT { TableAT {
b, b,
@@ -59,24 +52,23 @@ impl<'a> TableA<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
} }
} }
impl flatbuffers::Verifiable for TableA<'_> { impl ::flatbuffers::Verifiable for TableA<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)? .visit_field::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableAArgs<'a> {
} }
} }
pub struct TableABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableABuilder { TableABuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableA<'_> { impl ::core::fmt::Debug for TableA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableA"); let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b()); ds.field("b", &self.b());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableA<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableAT {
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableA<'b>> { ) -> ::flatbuffers::WIPOffset<TableA<'b>> {
let b = self.b.as_ref().map(|x|{ let b = self.b.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ABC: i32 = 0; pub const ENUM_MIN_ABC: i32 = 0;
@@ -47,8 +40,8 @@ impl ABC {
} }
} }
} }
impl core::fmt::Debug for ABC { impl ::core::fmt::Debug for ABC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for ABC {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for ABC { impl<'a> ::flatbuffers::Follow<'a> for ABC {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i32>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for ABC { impl ::flatbuffers::Push for ABC {
type Output = ABC; type Output = ABC;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i32>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for ABC { impl ::flatbuffers::EndianScalar for ABC {
type Scalar = i32; type Scalar = i32;
#[inline] #[inline]
fn to_little_endian(self) -> i32 { fn to_little_endian(self) -> i32 {
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for ABC {
} }
} }
impl<'a> flatbuffers::Verifiable for ABC { impl<'a> ::flatbuffers::Verifiable for ABC {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i32::run_verifier(v, pos) i32::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for ABC {} impl ::flatbuffers::SimpleToVerifyInSlice for ABC {}

View File

@@ -1,48 +1,41 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum KeywordsInTableOffset {} pub enum KeywordsInTableOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct KeywordsInTable<'a> { pub struct KeywordsInTable<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for KeywordsInTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for KeywordsInTable<'a> {
type Inner = KeywordsInTable<'a>; type Inner = KeywordsInTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> KeywordsInTable<'a> { impl<'a> KeywordsInTable<'a> {
pub const VT_IS: flatbuffers::VOffsetT = 4; pub const VT_IS: ::flatbuffers::VOffsetT = 4;
pub const VT_PRIVATE: flatbuffers::VOffsetT = 6; pub const VT_PRIVATE: ::flatbuffers::VOffsetT = 6;
pub const VT_TYPE_: flatbuffers::VOffsetT = 8; pub const VT_TYPE_: ::flatbuffers::VOffsetT = 8;
pub const VT_DEFAULT: flatbuffers::VOffsetT = 10; pub const VT_DEFAULT: ::flatbuffers::VOffsetT = 10;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.KeywordsInTable" "KeywordTest.KeywordsInTable"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
KeywordsInTable { _tab: table } KeywordsInTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args KeywordsInTableArgs args: &'args KeywordsInTableArgs
) -> flatbuffers::WIPOffset<KeywordsInTable<'bldr>> { ) -> ::flatbuffers::WIPOffset<KeywordsInTable<'bldr>> {
let mut builder = KeywordsInTableBuilder::new(_fbb); let mut builder = KeywordsInTableBuilder::new(_fbb);
builder.add_type_(args.type_); builder.add_type_(args.type_);
builder.add_private(args.private); builder.add_private(args.private);
@@ -94,12 +87,11 @@ impl<'a> KeywordsInTable<'a> {
} }
} }
impl flatbuffers::Verifiable for KeywordsInTable<'_> { impl ::flatbuffers::Verifiable for KeywordsInTable<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<ABC>("is", Self::VT_IS, false)? .visit_field::<ABC>("is", Self::VT_IS, false)?
.visit_field::<public>("private", Self::VT_PRIVATE, false)? .visit_field::<public>("private", Self::VT_PRIVATE, false)?
@@ -127,11 +119,11 @@ impl<'a> Default for KeywordsInTableArgs {
} }
} }
pub struct KeywordsInTableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct KeywordsInTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_is(&mut self, is: ABC) { pub fn add_is(&mut self, is: ABC) {
self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void); self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void);
@@ -149,7 +141,7 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b,
self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false); self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
KeywordsInTableBuilder { KeywordsInTableBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -157,14 +149,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<KeywordsInTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<KeywordsInTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for KeywordsInTable<'_> { impl ::core::fmt::Debug for KeywordsInTable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("KeywordsInTable"); let mut ds = f.debug_struct("KeywordsInTable");
ds.field("is", &self.is()); ds.field("is", &self.is());
ds.field("private", &self.private()); ds.field("private", &self.private());
@@ -192,10 +184,10 @@ impl Default for KeywordsInTableT {
} }
} }
impl KeywordsInTableT { impl KeywordsInTableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<KeywordsInTable<'b>> { ) -> ::flatbuffers::WIPOffset<KeywordsInTable<'b>> {
let is = self.is; let is = self.is;
let private = self.private; let private = self.private;
let type_ = self.type_; let type_ = self.type_;

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0; pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0;
@@ -47,8 +40,8 @@ impl KeywordsInUnion {
} }
} }
} }
impl core::fmt::Debug for KeywordsInUnion { impl ::core::fmt::Debug for KeywordsInUnion {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for KeywordsInUnion {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for KeywordsInUnion { impl<'a> ::flatbuffers::Follow<'a> for KeywordsInUnion {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for KeywordsInUnion { impl ::flatbuffers::Push for KeywordsInUnion {
type Output = KeywordsInUnion; type Output = KeywordsInUnion;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for KeywordsInUnion { impl ::flatbuffers::EndianScalar for KeywordsInUnion {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -87,17 +80,16 @@ impl flatbuffers::EndianScalar for KeywordsInUnion {
} }
} }
impl<'a> flatbuffers::Verifiable for KeywordsInUnion { impl<'a> ::flatbuffers::Verifiable for KeywordsInUnion {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {} impl ::flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {}
pub struct KeywordsInUnionUnionTableOffset {} pub struct KeywordsInUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -105,8 +97,8 @@ pub struct KeywordsInUnionUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum KeywordsInUnionT { pub enum KeywordsInUnionT {
NONE, NONE,
Static_(Box<KeywordsInTableT>), Static_(alloc::boxed::Box<KeywordsInTableT>),
Internal(Box<KeywordsInTableT>), Internal(alloc::boxed::Box<KeywordsInTableT>),
} }
impl Default for KeywordsInUnionT { impl Default for KeywordsInUnionT {
fn default() -> Self { fn default() -> Self {
@@ -121,7 +113,7 @@ impl KeywordsInUnionT {
Self::Internal(_) => KeywordsInUnion::internal, Self::Internal(_) => KeywordsInUnion::internal,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::Static_(v) => Some(v.pack(fbb).as_union_value()), Self::Static_(v) => Some(v.pack(fbb).as_union_value()),
@@ -129,9 +121,9 @@ impl KeywordsInUnionT {
} }
} }
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE. /// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_static_(&mut self) -> Option<Box<KeywordsInTableT>> { pub fn take_static_(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
if let Self::Static_(_) = self { if let Self::Static_(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Static_(w) = v { if let Self::Static_(w) = v {
Some(w) Some(w)
} else { } else {
@@ -150,9 +142,9 @@ impl KeywordsInUnionT {
if let Self::Static_(v) = self { Some(v.as_mut()) } else { None } if let Self::Static_(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE. /// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_internal(&mut self) -> Option<Box<KeywordsInTableT>> { pub fn take_internal(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
if let Self::Internal(_) = self { if let Self::Internal(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Internal(w) = v { if let Self::Internal(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_PUBLIC: i32 = 0; pub const ENUM_MIN_PUBLIC: i32 = 0;
@@ -39,8 +32,8 @@ impl public {
} }
} }
} }
impl core::fmt::Debug for public { impl ::core::fmt::Debug for public {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -48,24 +41,24 @@ impl core::fmt::Debug for public {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for public { impl<'a> ::flatbuffers::Follow<'a> for public {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i32>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for public { impl ::flatbuffers::Push for public {
type Output = public; type Output = public;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i32>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for public { impl ::flatbuffers::EndianScalar for public {
type Scalar = i32; type Scalar = i32;
#[inline] #[inline]
fn to_little_endian(self) -> i32 { fn to_little_endian(self) -> i32 {
@@ -79,14 +72,13 @@ impl flatbuffers::EndianScalar for public {
} }
} }
impl<'a> flatbuffers::Verifiable for public { impl<'a> ::flatbuffers::Verifiable for public {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i32::run_verifier(v, pos) i32::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for public {} impl ::flatbuffers::SimpleToVerifyInSlice for public {}

View File

@@ -1,46 +1,39 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum Table2Offset {} pub enum Table2Offset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Table2<'a> { pub struct Table2<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Table2<'a> { impl<'a> ::flatbuffers::Follow<'a> for Table2<'a> {
type Inner = Table2<'a>; type Inner = Table2<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Table2<'a> { impl<'a> Table2<'a> {
pub const VT_TYPE_TYPE: flatbuffers::VOffsetT = 4; pub const VT_TYPE_TYPE: ::flatbuffers::VOffsetT = 4;
pub const VT_TYPE_: flatbuffers::VOffsetT = 6; pub const VT_TYPE_: ::flatbuffers::VOffsetT = 6;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.Table2" "KeywordTest.Table2"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Table2 { _tab: table } Table2 { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args Table2Args args: &'args Table2Args
) -> flatbuffers::WIPOffset<Table2<'bldr>> { ) -> ::flatbuffers::WIPOffset<Table2<'bldr>> {
let mut builder = Table2Builder::new(_fbb); let mut builder = Table2Builder::new(_fbb);
if let Some(x) = args.type_ { builder.add_type_(x); } if let Some(x) = args.type_ { builder.add_type_(x); }
builder.add_type_type(args.type_type); builder.add_type_type(args.type_type);
@@ -50,12 +43,12 @@ impl<'a> Table2<'a> {
pub fn unpack(&self) -> Table2T { pub fn unpack(&self) -> Table2T {
let type_ = match self.type_type() { let type_ = match self.type_type() {
KeywordsInUnion::NONE => KeywordsInUnionT::NONE, KeywordsInUnion::NONE => KeywordsInUnionT::NONE,
KeywordsInUnion::static_ => KeywordsInUnionT::Static_(Box::new( KeywordsInUnion::static_ => KeywordsInUnionT::Static_(alloc::boxed::Box::new(
self.type__as_static_() self.type__as_static_()
.expect("Invalid union table, expected `KeywordsInUnion::static_`.") .expect("Invalid union table, expected `KeywordsInUnion::static_`.")
.unpack() .unpack()
)), )),
KeywordsInUnion::internal => KeywordsInUnionT::Internal(Box::new( KeywordsInUnion::internal => KeywordsInUnionT::Internal(alloc::boxed::Box::new(
self.type__as_internal() self.type__as_internal()
.expect("Invalid union table, expected `KeywordsInUnion::internal`.") .expect("Invalid union table, expected `KeywordsInUnion::internal`.")
.unpack() .unpack()
@@ -75,11 +68,11 @@ impl<'a> Table2<'a> {
unsafe { self._tab.get::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, Some(KeywordsInUnion::NONE)).unwrap()} unsafe { self._tab.get::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, Some(KeywordsInUnion::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn type_(&self) -> Option<flatbuffers::Table<'a>> { pub fn type_(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
@@ -113,17 +106,16 @@ impl<'a> Table2<'a> {
} }
impl flatbuffers::Verifiable for Table2<'_> { impl ::flatbuffers::Verifiable for Table2<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_union::<KeywordsInUnion, _>("type_type", Self::VT_TYPE_TYPE, "type_", Self::VT_TYPE_, false, |key, v, pos| { .visit_union::<KeywordsInUnion, _>("type_type", Self::VT_TYPE_TYPE, "type_", Self::VT_TYPE_, false, |key, v, pos| {
match key { match key {
KeywordsInUnion::static_ => v.verify_union_variant::<flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::static_", pos), KeywordsInUnion::static_ => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::static_", pos),
KeywordsInUnion::internal => v.verify_union_variant::<flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::internal", pos), KeywordsInUnion::internal => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::internal", pos),
_ => Ok(()), _ => Ok(()),
} }
})? })?
@@ -133,7 +125,7 @@ impl flatbuffers::Verifiable for Table2<'_> {
} }
pub struct Table2Args { pub struct Table2Args {
pub type_type: KeywordsInUnion, pub type_type: KeywordsInUnion,
pub type_: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>, pub type_: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
} }
impl<'a> Default for Table2Args { impl<'a> Default for Table2Args {
#[inline] #[inline]
@@ -145,21 +137,21 @@ impl<'a> Default for Table2Args {
} }
} }
pub struct Table2Builder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct Table2Builder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_type_type(&mut self, type_type: KeywordsInUnion) { pub fn add_type_type(&mut self, type_type: KeywordsInUnion) {
self.fbb_.push_slot::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, type_type, KeywordsInUnion::NONE); self.fbb_.push_slot::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, type_type, KeywordsInUnion::NONE);
} }
#[inline] #[inline]
pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) { pub fn add_type_(&mut self, type_: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
Table2Builder { Table2Builder {
fbb_: _fbb, fbb_: _fbb,
@@ -167,14 +159,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Table2<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Table2<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Table2<'_> { impl ::core::fmt::Debug for Table2<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Table2"); let mut ds = f.debug_struct("Table2");
ds.field("type_type", &self.type_type()); ds.field("type_type", &self.type_type());
match self.type_type() { match self.type_type() {
@@ -213,10 +205,10 @@ impl Default for Table2T {
} }
} }
impl Table2T { impl Table2T {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Table2<'b>> { ) -> ::flatbuffers::WIPOffset<Table2<'b>> {
let type_type = self.type_.keywords_in_union_type(); let type_type = self.type_.keywords_in_union_type();
let type_ = self.type_.pack(_fbb); let type_ = self.type_.pack(_fbb);
Table2::create(_fbb, &Table2Args{ Table2::create(_fbb, &Table2Args{

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Ability, aligned to 4 // struct Ability, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for Ability {
Self([0; 8]) Self([0; 8])
} }
} }
impl core::fmt::Debug for Ability { impl ::core::fmt::Debug for Ability {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Ability") f.debug_struct("Ability")
.field("id", &self.id()) .field("id", &self.id())
.field("distance", &self.distance()) .field("distance", &self.distance())
@@ -27,40 +20,39 @@ impl core::fmt::Debug for Ability {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Ability {} impl ::flatbuffers::SimpleToVerifyInSlice for Ability {}
impl<'a> flatbuffers::Follow<'a> for Ability { impl<'a> ::flatbuffers::Follow<'a> for Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Ability>::follow(buf, loc) } unsafe { <&'a Ability>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Ability { impl<'a> ::flatbuffers::Follow<'a> for &'a Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Ability>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Ability>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Ability { impl<'b> ::flatbuffers::Push for Ability {
type Output = Ability; type Output = Ability;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Ability { impl<'a> ::flatbuffers::Verifiable for Ability {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -82,30 +74,30 @@ impl<'a> Ability {
} }
pub fn id(&self) -> u32 { pub fn id(&self) -> u32 {
let mut mem = core::mem::MaybeUninit::<<u32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<u32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_id(&mut self, x: u32) { pub fn set_id(&mut self, x: u32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
@@ -121,30 +113,30 @@ impl<'a> Ability {
key.cmp(&val) key.cmp(&val)
} }
pub fn distance(&self) -> u32 { pub fn distance(&self) -> u32 {
let mut mem = core::mem::MaybeUninit::<<u32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<u32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_distance(&mut self, x: u32) { pub fn set_distance(&mut self, x: u32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
@@ -51,8 +44,8 @@ impl AnyAmbiguousAliases {
} }
} }
} }
impl core::fmt::Debug for AnyAmbiguousAliases { impl ::core::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -60,24 +53,24 @@ impl core::fmt::Debug for AnyAmbiguousAliases {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for AnyAmbiguousAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for AnyAmbiguousAliases { impl ::flatbuffers::Push for AnyAmbiguousAliases {
type Output = AnyAmbiguousAliases; type Output = AnyAmbiguousAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for AnyAmbiguousAliases { impl ::flatbuffers::EndianScalar for AnyAmbiguousAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -91,17 +84,16 @@ impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
} }
} }
impl<'a> flatbuffers::Verifiable for AnyAmbiguousAliases { impl<'a> ::flatbuffers::Verifiable for AnyAmbiguousAliases {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
pub struct AnyAmbiguousAliasesUnionTableOffset {} pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -109,9 +101,9 @@ pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum AnyAmbiguousAliasesT { pub enum AnyAmbiguousAliasesT {
NONE, NONE,
M1(Box<MonsterT>), M1(alloc::boxed::Box<MonsterT>),
M2(Box<MonsterT>), M2(alloc::boxed::Box<MonsterT>),
M3(Box<MonsterT>), M3(alloc::boxed::Box<MonsterT>),
} }
impl Default for AnyAmbiguousAliasesT { impl Default for AnyAmbiguousAliasesT {
fn default() -> Self { fn default() -> Self {
@@ -127,7 +119,7 @@ impl AnyAmbiguousAliasesT {
Self::M3(_) => AnyAmbiguousAliases::M3, Self::M3(_) => AnyAmbiguousAliases::M3,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::M1(v) => Some(v.pack(fbb).as_union_value()), Self::M1(v) => Some(v.pack(fbb).as_union_value()),
@@ -136,9 +128,9 @@ impl AnyAmbiguousAliasesT {
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<Box<MonsterT>> { pub fn take_m1(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M1(_) = self { if let Self::M1(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M1(w) = v { if let Self::M1(w) = v {
Some(w) Some(w)
} else { } else {
@@ -157,9 +149,9 @@ impl AnyAmbiguousAliasesT {
if let Self::M1(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v { if let Self::M2(w) = v {
Some(w) Some(w)
} else { } else {
@@ -178,9 +170,9 @@ impl AnyAmbiguousAliasesT {
if let Self::M2(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<Box<MonsterT>> { pub fn take_m3(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M3(_) = self { if let Self::M3(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M3(w) = v { if let Self::M3(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY: u8 = 0;
@@ -51,8 +44,8 @@ impl Any {
} }
} }
} }
impl core::fmt::Debug for Any { impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -60,24 +53,24 @@ impl core::fmt::Debug for Any {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for Any { impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Any { impl ::flatbuffers::Push for Any {
type Output = Any; type Output = Any;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Any { impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -91,17 +84,16 @@ impl flatbuffers::EndianScalar for Any {
} }
} }
impl<'a> flatbuffers::Verifiable for Any { impl<'a> ::flatbuffers::Verifiable for Any {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Any {} impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub struct AnyUnionTableOffset {} pub struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -109,9 +101,9 @@ pub struct AnyUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum AnyT { pub enum AnyT {
NONE, NONE,
Monster(Box<MonsterT>), Monster(alloc::boxed::Box<MonsterT>),
TestSimpleTableWithEnum(Box<TestSimpleTableWithEnumT>), TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>),
MyGameExample2Monster(Box<super::example_2::MonsterT>), MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyT { impl Default for AnyT {
fn default() -> Self { fn default() -> Self {
@@ -127,7 +119,7 @@ impl AnyT {
Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster, 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>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::Monster(v) => Some(v.pack(fbb).as_union_value()), Self::Monster(v) => Some(v.pack(fbb).as_union_value()),
@@ -136,9 +128,9 @@ impl AnyT {
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<Box<MonsterT>> { pub fn take_monster(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::Monster(_) = self { if let Self::Monster(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Monster(w) = v { if let Self::Monster(w) = v {
Some(w) Some(w)
} else { } else {
@@ -157,9 +149,9 @@ impl AnyT {
if let Self::Monster(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> { pub fn take_test_simple_table_with_enum(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self { if let Self::TestSimpleTableWithEnum(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::TestSimpleTableWithEnum(w) = v { if let Self::TestSimpleTableWithEnum(w) = v {
Some(w) Some(w)
} else { } else {
@@ -178,9 +170,9 @@ impl AnyT {
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> { pub fn take_my_game_example_2_monster(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self { if let Self::MyGameExample2Monster(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::MyGameExample2Monster(w) = v { if let Self::MyGameExample2Monster(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
@@ -51,8 +44,8 @@ impl AnyUniqueAliases {
} }
} }
} }
impl core::fmt::Debug for AnyUniqueAliases { impl ::core::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -60,24 +53,24 @@ impl core::fmt::Debug for AnyUniqueAliases {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for AnyUniqueAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for AnyUniqueAliases { impl ::flatbuffers::Push for AnyUniqueAliases {
type Output = AnyUniqueAliases; type Output = AnyUniqueAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for AnyUniqueAliases { impl ::flatbuffers::EndianScalar for AnyUniqueAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -91,17 +84,16 @@ impl flatbuffers::EndianScalar for AnyUniqueAliases {
} }
} }
impl<'a> flatbuffers::Verifiable for AnyUniqueAliases { impl<'a> ::flatbuffers::Verifiable for AnyUniqueAliases {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
pub struct AnyUniqueAliasesUnionTableOffset {} pub struct AnyUniqueAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -109,9 +101,9 @@ pub struct AnyUniqueAliasesUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum AnyUniqueAliasesT { pub enum AnyUniqueAliasesT {
NONE, NONE,
M(Box<MonsterT>), M(alloc::boxed::Box<MonsterT>),
TS(Box<TestSimpleTableWithEnumT>), TS(alloc::boxed::Box<TestSimpleTableWithEnumT>),
M2(Box<super::example_2::MonsterT>), M2(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyUniqueAliasesT { impl Default for AnyUniqueAliasesT {
fn default() -> Self { fn default() -> Self {
@@ -127,7 +119,7 @@ impl AnyUniqueAliasesT {
Self::M2(_) => AnyUniqueAliases::M2, Self::M2(_) => AnyUniqueAliases::M2,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::M(v) => Some(v.pack(fbb).as_union_value()), Self::M(v) => Some(v.pack(fbb).as_union_value()),
@@ -136,9 +128,9 @@ impl AnyUniqueAliasesT {
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<Box<MonsterT>> { pub fn take_m(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M(_) = self { if let Self::M(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M(w) = v { if let Self::M(w) = v {
Some(w) Some(w)
} else { } else {
@@ -157,9 +149,9 @@ impl AnyUniqueAliasesT {
if let Self::M(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> { pub fn take_ts(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self { if let Self::TS(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::TS(w) = v { if let Self::TS(w) = v {
Some(w) Some(w)
} else { } else {
@@ -178,9 +170,9 @@ impl AnyUniqueAliasesT {
if let Self::TS(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v { if let Self::M2(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,17 +1,10 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_color { mod bitflags_color {
flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
/// Composite components of Monster color. /// Composite components of Monster color.
#[derive(Default, Debug, Clone, Copy, PartialEq)] #[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct Color: u8 { pub struct Color: u8 {
@@ -26,24 +19,24 @@ mod bitflags_color {
} }
pub use self::bitflags_color::Color; pub use self::bitflags_color::Color;
impl<'a> flatbuffers::Follow<'a> for Color { impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self::from_bits_retain(b) Self::from_bits_retain(b)
} }
} }
impl flatbuffers::Push for Color { impl ::flatbuffers::Push for Color {
type Output = Color; type Output = Color;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.bits()); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
} }
} }
impl flatbuffers::EndianScalar for Color { impl ::flatbuffers::EndianScalar for Color {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -57,14 +50,13 @@ impl flatbuffers::EndianScalar for Color {
} }
} }
impl<'a> flatbuffers::Verifiable for Color { impl<'a> ::flatbuffers::Verifiable for Color {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Color {} impl ::flatbuffers::SimpleToVerifyInSlice for Color {}

View File

@@ -1,17 +1,10 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_long_enum { mod bitflags_long_enum {
flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
#[derive(Default, Debug, Clone, Copy, PartialEq)] #[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct LongEnum: u64 { pub struct LongEnum: u64 {
const LongOne = 2; const LongOne = 2;
@@ -22,24 +15,24 @@ mod bitflags_long_enum {
} }
pub use self::bitflags_long_enum::LongEnum; pub use self::bitflags_long_enum::LongEnum;
impl<'a> flatbuffers::Follow<'a> for LongEnum { impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) };
Self::from_bits_retain(b) Self::from_bits_retain(b)
} }
} }
impl flatbuffers::Push for LongEnum { impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum; type Output = LongEnum;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u64>(dst, self.bits()); } unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
} }
} }
impl flatbuffers::EndianScalar for LongEnum { impl ::flatbuffers::EndianScalar for LongEnum {
type Scalar = u64; type Scalar = u64;
#[inline] #[inline]
fn to_little_endian(self) -> u64 { fn to_little_endian(self) -> u64 {
@@ -53,14 +46,13 @@ impl flatbuffers::EndianScalar for LongEnum {
} }
} }
impl<'a> flatbuffers::Verifiable for LongEnum { impl<'a> ::flatbuffers::Verifiable for LongEnum {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u64::run_verifier(v, pos) u64::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for LongEnum {} impl ::flatbuffers::SimpleToVerifyInSlice for LongEnum {}

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_RACE: i8 = -1;
@@ -51,8 +44,8 @@ impl Race {
} }
} }
} }
impl core::fmt::Debug for Race { impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -60,24 +53,24 @@ impl core::fmt::Debug for Race {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for Race { impl<'a> ::flatbuffers::Follow<'a> for Race {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Race { impl ::flatbuffers::Push for Race {
type Output = Race; type Output = Race;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Race { impl ::flatbuffers::EndianScalar for Race {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -91,14 +84,13 @@ impl flatbuffers::EndianScalar for Race {
} }
} }
impl<'a> flatbuffers::Verifiable for Race { impl<'a> ::flatbuffers::Verifiable for Race {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Race {} impl ::flatbuffers::SimpleToVerifyInSlice for Race {}

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum ReferrableOffset {} pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Referrable<'a> { pub struct Referrable<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Referrable<'a> { impl<'a> ::flatbuffers::Follow<'a> for Referrable<'a> {
type Inner = Referrable<'a>; type Inner = Referrable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Referrable<'a> { impl<'a> Referrable<'a> {
pub const VT_ID: flatbuffers::VOffsetT = 4; pub const VT_ID: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.Referrable" "MyGame.Example.Referrable"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Referrable { _tab: table } Referrable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ReferrableArgs args: &'args ReferrableArgs
) -> flatbuffers::WIPOffset<Referrable<'bldr>> { ) -> ::flatbuffers::WIPOffset<Referrable<'bldr>> {
let mut builder = ReferrableBuilder::new(_fbb); let mut builder = ReferrableBuilder::new(_fbb);
builder.add_id(args.id); builder.add_id(args.id);
builder.finish() builder.finish()
@@ -71,12 +64,11 @@ impl<'a> Referrable<'a> {
} }
} }
impl flatbuffers::Verifiable for Referrable<'_> { impl ::flatbuffers::Verifiable for Referrable<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<u64>("id", Self::VT_ID, false)? .visit_field::<u64>("id", Self::VT_ID, false)?
.finish(); .finish();
@@ -95,17 +87,17 @@ impl<'a> Default for ReferrableArgs {
} }
} }
pub struct ReferrableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct ReferrableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: u64) { pub fn add_id(&mut self, id: u64) {
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0); self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
ReferrableBuilder { ReferrableBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -113,14 +105,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Referrable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Referrable<'_> { impl ::core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Referrable"); let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id()); ds.field("id", &self.id());
ds.finish() ds.finish()
@@ -139,10 +131,10 @@ impl Default for ReferrableT {
} }
} }
impl ReferrableT { impl ReferrableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Referrable<'b>> { ) -> ::flatbuffers::WIPOffset<Referrable<'b>> {
let id = self.id; let id = self.id;
Referrable::create(_fbb, &ReferrableArgs{ Referrable::create(_fbb, &ReferrableArgs{
id, id,

View File

@@ -1,47 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum StatOffset {} pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Stat<'a> { pub struct Stat<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Stat<'a> { impl<'a> ::flatbuffers::Follow<'a> for Stat<'a> {
type Inner = Stat<'a>; type Inner = Stat<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Stat<'a> { impl<'a> Stat<'a> {
pub const VT_ID: flatbuffers::VOffsetT = 4; pub const VT_ID: ::flatbuffers::VOffsetT = 4;
pub const VT_VAL: flatbuffers::VOffsetT = 6; pub const VT_VAL: ::flatbuffers::VOffsetT = 6;
pub const VT_COUNT: flatbuffers::VOffsetT = 8; pub const VT_COUNT: ::flatbuffers::VOffsetT = 8;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.Stat" "MyGame.Example.Stat"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Stat { _tab: table } Stat { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args StatArgs<'args> args: &'args StatArgs<'args>
) -> flatbuffers::WIPOffset<Stat<'bldr>> { ) -> ::flatbuffers::WIPOffset<Stat<'bldr>> {
let mut builder = StatBuilder::new(_fbb); let mut builder = StatBuilder::new(_fbb);
builder.add_val(args.val); builder.add_val(args.val);
if let Some(x) = args.id { builder.add_id(x); } if let Some(x) = args.id { builder.add_id(x); }
@@ -51,7 +44,7 @@ impl<'a> Stat<'a> {
pub fn unpack(&self) -> StatT { pub fn unpack(&self) -> StatT {
let id = self.id().map(|x| { let id = self.id().map(|x| {
x.to_string() alloc::string::ToString::to_string(x)
}); });
let val = self.val(); let val = self.val();
let count = self.count(); let count = self.count();
@@ -67,7 +60,7 @@ impl<'a> Stat<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)}
} }
#[inline] #[inline]
pub fn val(&self) -> i64 { pub fn val(&self) -> i64 {
@@ -95,14 +88,13 @@ impl<'a> Stat<'a> {
} }
} }
impl flatbuffers::Verifiable for Stat<'_> { impl ::flatbuffers::Verifiable for Stat<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("id", Self::VT_ID, false)? .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("id", Self::VT_ID, false)?
.visit_field::<i64>("val", Self::VT_VAL, false)? .visit_field::<i64>("val", Self::VT_VAL, false)?
.visit_field::<u16>("count", Self::VT_COUNT, false)? .visit_field::<u16>("count", Self::VT_COUNT, false)?
.finish(); .finish();
@@ -110,7 +102,7 @@ impl flatbuffers::Verifiable for Stat<'_> {
} }
} }
pub struct StatArgs<'a> { pub struct StatArgs<'a> {
pub id: Option<flatbuffers::WIPOffset<&'a str>>, pub id: Option<::flatbuffers::WIPOffset<&'a str>>,
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
@@ -125,14 +117,14 @@ impl<'a> Default for StatArgs<'a> {
} }
} }
pub struct StatBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct StatBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { pub fn add_id(&mut self, id: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Stat::VT_ID, id); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
} }
#[inline] #[inline]
pub fn add_val(&mut self, val: i64) { pub fn add_val(&mut self, val: i64) {
@@ -143,7 +135,7 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0); self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
StatBuilder { StatBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -151,14 +143,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Stat<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Stat<'_> { impl ::core::fmt::Debug for Stat<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Stat"); let mut ds = f.debug_struct("Stat");
ds.field("id", &self.id()); ds.field("id", &self.id());
ds.field("val", &self.val()); ds.field("val", &self.val());
@@ -169,7 +161,7 @@ impl core::fmt::Debug for Stat<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct StatT { pub struct StatT {
pub id: Option<String>, pub id: Option<alloc::string::String>,
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
@@ -183,10 +175,10 @@ impl Default for StatT {
} }
} }
impl StatT { impl StatT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Stat<'b>> { ) -> ::flatbuffers::WIPOffset<Stat<'b>> {
let id = self.id.as_ref().map(|x|{ let id = self.id.as_ref().map(|x|{
_fbb.create_string(x) _fbb.create_string(x)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct StructOfStructs, aligned to 4 // struct StructOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for StructOfStructs {
Self([0; 20]) Self([0; 20])
} }
} }
impl core::fmt::Debug for StructOfStructs { impl ::core::fmt::Debug for StructOfStructs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructs") f.debug_struct("StructOfStructs")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -28,40 +21,39 @@ impl core::fmt::Debug for StructOfStructs {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for StructOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructs {}
impl<'a> flatbuffers::Follow<'a> for StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for StructOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructs {
type Output = StructOfStructs; type Output = StructOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for StructOfStructs { impl<'a> ::flatbuffers::Verifiable for StructOfStructs {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct StructOfStructsOfStructs, aligned to 4 // struct StructOfStructsOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,48 +11,47 @@ impl Default for StructOfStructsOfStructs {
Self([0; 20]) Self([0; 20])
} }
} }
impl core::fmt::Debug for StructOfStructsOfStructs { impl ::core::fmt::Debug for StructOfStructsOfStructs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructsOfStructs") f.debug_struct("StructOfStructsOfStructs")
.field("a", &self.a()) .field("a", &self.a())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
impl<'a> flatbuffers::Follow<'a> for StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for StructOfStructsOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructsOfStructs {
type Output = StructOfStructsOfStructs; type Output = StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for StructOfStructsOfStructs { impl<'a> ::flatbuffers::Verifiable for StructOfStructsOfStructs {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Test, aligned to 2 // struct Test, aligned to 2
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for Test {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Test { impl ::core::fmt::Debug for Test {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Test") f.debug_struct("Test")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -27,40 +20,39 @@ impl core::fmt::Debug for Test {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Test {} impl ::flatbuffers::SimpleToVerifyInSlice for Test {}
impl<'a> flatbuffers::Follow<'a> for Test { impl<'a> ::flatbuffers::Follow<'a> for Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Test>::follow(buf, loc) } unsafe { <&'a Test>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Test { impl<'a> ::flatbuffers::Follow<'a> for &'a Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Test>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Test { impl<'b> ::flatbuffers::Push for Test {
type Output = Test; type Output = Test;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(2) ::flatbuffers::PushAlignment::new(2)
} }
} }
impl<'a> flatbuffers::Verifiable for Test { impl<'a> ::flatbuffers::Verifiable for Test {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -82,59 +74,59 @@ impl<'a> Test {
} }
pub fn a(&self) -> i16 { pub fn a(&self) -> i16 {
let mut mem = core::mem::MaybeUninit::<<i16 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i16 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i16 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i16 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i16) { pub fn set_a(&mut self, x: i16) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i16 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i16 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn b(&self) -> i8 { pub fn b(&self) -> i8 {
let mut mem = core::mem::MaybeUninit::<<i8 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i8 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[2..].as_ptr(), self.0[2..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_b(&mut self, x: i8) { pub fn set_b(&mut self, x: i8) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[2..].as_mut_ptr(), self.0[2..].as_mut_ptr(),
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TestSimpleTableWithEnumOffset {} pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TestSimpleTableWithEnum<'a> { pub struct TestSimpleTableWithEnum<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> { impl<'a> ::flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
type Inner = TestSimpleTableWithEnum<'a>; type Inner = TestSimpleTableWithEnum<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TestSimpleTableWithEnum<'a> { impl<'a> TestSimpleTableWithEnum<'a> {
pub const VT_COLOR: flatbuffers::VOffsetT = 4; pub const VT_COLOR: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.TestSimpleTableWithEnum" "MyGame.Example.TestSimpleTableWithEnum"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TestSimpleTableWithEnum { _tab: table } TestSimpleTableWithEnum { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TestSimpleTableWithEnumArgs args: &'args TestSimpleTableWithEnumArgs
) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> { ) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> {
let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb); let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb);
builder.add_color(args.color); builder.add_color(args.color);
builder.finish() builder.finish()
@@ -61,12 +54,11 @@ impl<'a> TestSimpleTableWithEnum<'a> {
} }
} }
impl flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> { impl ::flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<Color>("color", Self::VT_COLOR, false)? .visit_field::<Color>("color", Self::VT_COLOR, false)?
.finish(); .finish();
@@ -85,17 +77,17 @@ impl<'a> Default for TestSimpleTableWithEnumArgs {
} }
} }
pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green); self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TestSimpleTableWithEnumBuilder { TestSimpleTableWithEnumBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TestSimpleTableWithEnum<'_> { impl ::core::fmt::Debug for TestSimpleTableWithEnum<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TestSimpleTableWithEnum"); let mut ds = f.debug_struct("TestSimpleTableWithEnum");
ds.field("color", &self.color()); ds.field("color", &self.color());
ds.finish() ds.finish()
@@ -129,10 +121,10 @@ impl Default for TestSimpleTableWithEnumT {
} }
} }
impl TestSimpleTableWithEnumT { impl TestSimpleTableWithEnumT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>> { ) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>> {
let color = self.color; let color = self.color;
TestSimpleTableWithEnum::create(_fbb, &TestSimpleTableWithEnumArgs{ TestSimpleTableWithEnum::create(_fbb, &TestSimpleTableWithEnumArgs{
color, color,

View File

@@ -1,56 +1,49 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TypeAliasesOffset {} pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TypeAliases<'a> { pub struct TypeAliases<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> { impl<'a> ::flatbuffers::Follow<'a> for TypeAliases<'a> {
type Inner = TypeAliases<'a>; type Inner = TypeAliases<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TypeAliases<'a> { impl<'a> TypeAliases<'a> {
pub const VT_I8_: flatbuffers::VOffsetT = 4; pub const VT_I8_: ::flatbuffers::VOffsetT = 4;
pub const VT_U8_: flatbuffers::VOffsetT = 6; pub const VT_U8_: ::flatbuffers::VOffsetT = 6;
pub const VT_I16_: flatbuffers::VOffsetT = 8; pub const VT_I16_: ::flatbuffers::VOffsetT = 8;
pub const VT_U16_: flatbuffers::VOffsetT = 10; pub const VT_U16_: ::flatbuffers::VOffsetT = 10;
pub const VT_I32_: flatbuffers::VOffsetT = 12; pub const VT_I32_: ::flatbuffers::VOffsetT = 12;
pub const VT_U32_: flatbuffers::VOffsetT = 14; pub const VT_U32_: ::flatbuffers::VOffsetT = 14;
pub const VT_I64_: flatbuffers::VOffsetT = 16; pub const VT_I64_: ::flatbuffers::VOffsetT = 16;
pub const VT_U64_: flatbuffers::VOffsetT = 18; pub const VT_U64_: ::flatbuffers::VOffsetT = 18;
pub const VT_F32_: flatbuffers::VOffsetT = 20; pub const VT_F32_: ::flatbuffers::VOffsetT = 20;
pub const VT_F64_: flatbuffers::VOffsetT = 22; pub const VT_F64_: ::flatbuffers::VOffsetT = 22;
pub const VT_V8: flatbuffers::VOffsetT = 24; pub const VT_V8: ::flatbuffers::VOffsetT = 24;
pub const VT_VF64: flatbuffers::VOffsetT = 26; pub const VT_VF64: ::flatbuffers::VOffsetT = 26;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.TypeAliases" "MyGame.Example.TypeAliases"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TypeAliases { _tab: table } TypeAliases { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TypeAliasesArgs<'args> args: &'args TypeAliasesArgs<'args>
) -> flatbuffers::WIPOffset<TypeAliases<'bldr>> { ) -> ::flatbuffers::WIPOffset<TypeAliases<'bldr>> {
let mut builder = TypeAliasesBuilder::new(_fbb); let mut builder = TypeAliasesBuilder::new(_fbb);
builder.add_f64_(args.f64_); builder.add_f64_(args.f64_);
builder.add_u64_(args.u64_); builder.add_u64_(args.u64_);
@@ -171,27 +164,26 @@ impl<'a> TypeAliases<'a> {
unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()} unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn v8(&self) -> Option<flatbuffers::Vector<'a, i8>> { pub fn v8(&self) -> Option<::flatbuffers::Vector<'a, i8>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)}
} }
#[inline] #[inline]
pub fn vf64(&self) -> Option<flatbuffers::Vector<'a, f64>> { pub fn vf64(&self) -> Option<::flatbuffers::Vector<'a, f64>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(TypeAliases::VT_VF64, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f64>>>(TypeAliases::VT_VF64, None)}
} }
} }
impl flatbuffers::Verifiable for TypeAliases<'_> { impl ::flatbuffers::Verifiable for TypeAliases<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i8>("i8_", Self::VT_I8_, false)? .visit_field::<i8>("i8_", Self::VT_I8_, false)?
.visit_field::<u8>("u8_", Self::VT_U8_, false)? .visit_field::<u8>("u8_", Self::VT_U8_, false)?
@@ -203,8 +195,8 @@ impl flatbuffers::Verifiable for TypeAliases<'_> {
.visit_field::<u64>("u64_", Self::VT_U64_, false)? .visit_field::<u64>("u64_", Self::VT_U64_, false)?
.visit_field::<f32>("f32_", Self::VT_F32_, false)? .visit_field::<f32>("f32_", Self::VT_F32_, false)?
.visit_field::<f64>("f64_", Self::VT_F64_, false)? .visit_field::<f64>("f64_", Self::VT_F64_, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i8>>>("v8", Self::VT_V8, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, i8>>>("v8", Self::VT_V8, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("vf64", Self::VT_VF64, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f64>>>("vf64", Self::VT_VF64, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
@@ -220,8 +212,8 @@ pub struct TypeAliasesArgs<'a> {
pub u64_: u64, pub u64_: u64,
pub f32_: f32, pub f32_: f32,
pub f64_: f64, pub f64_: f64,
pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i8>>>, pub v8: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i8>>>,
pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>, pub vf64: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f64>>>,
} }
impl<'a> Default for TypeAliasesArgs<'a> { impl<'a> Default for TypeAliasesArgs<'a> {
#[inline] #[inline]
@@ -243,11 +235,11 @@ impl<'a> Default for TypeAliasesArgs<'a> {
} }
} }
pub struct TypeAliasesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TypeAliasesBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_i8_(&mut self, i8_: i8) { pub fn add_i8_(&mut self, i8_: i8) {
self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0); self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
@@ -289,15 +281,15 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0); self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
} }
#[inline] #[inline]
pub fn add_v8(&mut self, v8: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>) { pub fn add_v8(&mut self, v8: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
} }
#[inline] #[inline]
pub fn add_vf64(&mut self, vf64: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) { pub fn add_vf64(&mut self, vf64: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TypeAliasesBuilder { TypeAliasesBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -305,14 +297,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TypeAliases<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TypeAliases<'_> { impl ::core::fmt::Debug for TypeAliases<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TypeAliases"); let mut ds = f.debug_struct("TypeAliases");
ds.field("i8_", &self.i8_()); ds.field("i8_", &self.i8_());
ds.field("u8_", &self.u8_()); ds.field("u8_", &self.u8_());
@@ -342,8 +334,8 @@ pub struct TypeAliasesT {
pub u64_: u64, pub u64_: u64,
pub f32_: f32, pub f32_: f32,
pub f64_: f64, pub f64_: f64,
pub v8: Option<Vec<i8>>, pub v8: Option<alloc::vec::Vec<i8>>,
pub vf64: Option<Vec<f64>>, pub vf64: Option<alloc::vec::Vec<f64>>,
} }
impl Default for TypeAliasesT { impl Default for TypeAliasesT {
fn default() -> Self { fn default() -> Self {
@@ -364,10 +356,10 @@ impl Default for TypeAliasesT {
} }
} }
impl TypeAliasesT { impl TypeAliasesT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TypeAliases<'b>> { ) -> ::flatbuffers::WIPOffset<TypeAliases<'b>> {
let i8_ = self.i8_; let i8_ = self.i8_;
let u8_ = self.u8_; let u8_ = self.u8_;
let i16_ = self.i16_; let i16_ = self.i16_;

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Vec3, aligned to 8 // struct Vec3, aligned to 8
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for Vec3 {
Self([0; 32]) Self([0; 32])
} }
} }
impl core::fmt::Debug for Vec3 { impl ::core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Vec3") f.debug_struct("Vec3")
.field("x", &self.x()) .field("x", &self.x())
.field("y", &self.y()) .field("y", &self.y())
@@ -31,40 +24,39 @@ impl core::fmt::Debug for Vec3 {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Vec3 {} impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {}
impl<'a> flatbuffers::Follow<'a> for Vec3 { impl<'a> ::flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Vec3>::follow(buf, loc) } unsafe { <&'a Vec3>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Vec3 { impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Vec3>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Vec3 { impl<'b> ::flatbuffers::Push for Vec3 {
type Output = Vec3; type Output = Vec3;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
} }
} }
impl<'a> flatbuffers::Verifiable for Vec3 { impl<'a> ::flatbuffers::Verifiable for Vec3 {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -94,146 +86,146 @@ impl<'a> Vec3 {
} }
pub fn x(&self) -> f32 { pub fn x(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_x(&mut self, x: f32) { pub fn set_x(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn y(&self) -> f32 { pub fn y(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_y(&mut self, x: f32) { pub fn set_y(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn z(&self) -> f32 { pub fn z(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(), self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_z(&mut self, x: f32) { pub fn set_z(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[8..].as_mut_ptr(), self.0[8..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn test1(&self) -> f64 { pub fn test1(&self) -> f64 {
let mut mem = core::mem::MaybeUninit::<<f64 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f64 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[16..].as_ptr(), self.0[16..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f64 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f64 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_test1(&mut self, x: f64) { pub fn set_test1(&mut self, x: f64) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[16..].as_mut_ptr(), self.0[16..].as_mut_ptr(),
core::mem::size_of::<<f64 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f64 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn test2(&self) -> Color { pub fn test2(&self) -> Color {
let mut mem = core::mem::MaybeUninit::<<Color as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<Color as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[24..].as_ptr(), self.0[24..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<Color as EndianScalar>::Scalar>(), ::core::mem::size_of::<<Color as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_test2(&mut self, x: Color) { pub fn set_test2(&mut self, x: Color) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[24..].as_mut_ptr(), self.0[24..].as_mut_ptr(),
core::mem::size_of::<<Color as EndianScalar>::Scalar>(), ::core::mem::size_of::<<Color as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,26 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum MonsterOffset {} pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -31,14 +24,14 @@ impl<'a> Monster<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args MonsterArgs _args: &'args MonsterArgs
) -> flatbuffers::WIPOffset<Monster<'bldr>> { ) -> ::flatbuffers::WIPOffset<Monster<'bldr>> {
let mut builder = MonsterBuilder::new(_fbb); let mut builder = MonsterBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -49,12 +42,11 @@ impl<'a> Monster<'a> {
} }
} }
impl flatbuffers::Verifiable for Monster<'_> { impl ::flatbuffers::Verifiable for Monster<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -70,13 +62,13 @@ impl<'a> Default for MonsterArgs {
} }
} }
pub struct MonsterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
MonsterBuilder { MonsterBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -84,14 +76,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Monster<'_> { impl ::core::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Monster"); let mut ds = f.debug_struct("Monster");
ds.finish() ds.finish()
} }
@@ -107,10 +99,10 @@ impl Default for MonsterT {
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Monster<'b>> { ) -> ::flatbuffers::WIPOffset<Monster<'b>> {
Monster::create(_fbb, &MonsterArgs{ Monster::create(_fbb, &MonsterArgs{
}) })
} }

View File

@@ -1,26 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum InParentNamespaceOffset {} pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct InParentNamespace<'a> { pub struct InParentNamespace<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> { impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
type Inner = InParentNamespace<'a>; type Inner = InParentNamespace<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -31,14 +24,14 @@ impl<'a> InParentNamespace<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
InParentNamespace { _tab: table } InParentNamespace { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args InParentNamespaceArgs _args: &'args InParentNamespaceArgs
) -> flatbuffers::WIPOffset<InParentNamespace<'bldr>> { ) -> ::flatbuffers::WIPOffset<InParentNamespace<'bldr>> {
let mut builder = InParentNamespaceBuilder::new(_fbb); let mut builder = InParentNamespaceBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -49,12 +42,11 @@ impl<'a> InParentNamespace<'a> {
} }
} }
impl flatbuffers::Verifiable for InParentNamespace<'_> { impl ::flatbuffers::Verifiable for InParentNamespace<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -70,13 +62,13 @@ impl<'a> Default for InParentNamespaceArgs {
} }
} }
pub struct InParentNamespaceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct InParentNamespaceBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
InParentNamespaceBuilder { InParentNamespaceBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -84,14 +76,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<InParentNamespace<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for InParentNamespace<'_> { impl ::core::fmt::Debug for InParentNamespace<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("InParentNamespace"); let mut ds = f.debug_struct("InParentNamespace");
ds.finish() ds.finish()
} }
@@ -107,10 +99,10 @@ impl Default for InParentNamespaceT {
} }
} }
impl InParentNamespaceT { impl InParentNamespaceT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<InParentNamespace<'b>> { ) -> ::flatbuffers::WIPOffset<InParentNamespace<'b>> {
InParentNamespace::create(_fbb, &InParentNamespaceArgs{ InParentNamespace::create(_fbb, &InParentNamespaceArgs{
}) })
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -39,8 +32,8 @@ impl FromInclude {
} }
} }
} }
impl core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -48,24 +41,24 @@ impl core::fmt::Debug for FromInclude {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
@@ -79,14 +72,13 @@ impl flatbuffers::EndianScalar for FromInclude {
} }
} }
impl<'a> flatbuffers::Verifiable for FromInclude { impl<'a> ::flatbuffers::Verifiable for FromInclude {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i64::run_verifier(v, pos) i64::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for FromInclude {} impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableBOffset {} pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableB<'a> { impl<'a> TableB<'a> {
pub const VT_A: flatbuffers::VOffsetT = 4; pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB" "MyGame.OtherNameSpace.TableB"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args> args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb); let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); } if let Some(x) = args.a { builder.add_a(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT { pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| { let a = self.a().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableBT { TableBT {
a, a,
@@ -59,24 +52,23 @@ impl<'a> TableB<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
} }
} }
impl flatbuffers::Verifiable for TableB<'_> { impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableBArgs<'a> {
} }
} }
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableBBuilder { TableBBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableB<'_> { impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB"); let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a()); ds.field("a", &self.a());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableBT {
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> { ) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{ let a = self.a.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,48 +11,47 @@ impl Default for Unused {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
.field("a", &self.a()) .field("a", &self.a())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Unused { impl<'a> ::flatbuffers::Verifiable for Unused {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -79,30 +71,30 @@ impl<'a> Unused {
} }
pub fn a(&self) -> i32 { pub fn a(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i32) { pub fn set_a(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableAOffset {} pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableA<'a> { impl<'a> TableA<'a> {
pub const VT_B: flatbuffers::VOffsetT = 4; pub const VT_B: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"TableA" "TableA"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableAArgs<'args> args: &'args TableAArgs<'args>
) -> flatbuffers::WIPOffset<TableA<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableA<'bldr>> {
let mut builder = TableABuilder::new(_fbb); let mut builder = TableABuilder::new(_fbb);
if let Some(x) = args.b { builder.add_b(x); } if let Some(x) = args.b { builder.add_b(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableA<'a> {
pub fn unpack(&self) -> TableAT { pub fn unpack(&self) -> TableAT {
let b = self.b().map(|x| { let b = self.b().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableAT { TableAT {
b, b,
@@ -59,24 +52,23 @@ impl<'a> TableA<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
} }
} }
impl flatbuffers::Verifiable for TableA<'_> { impl ::flatbuffers::Verifiable for TableA<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)? .visit_field::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableAArgs<'a> {
} }
} }
pub struct TableABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableABuilder { TableABuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableA<'_> { impl ::core::fmt::Debug for TableA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableA"); let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b()); ds.field("b", &self.b());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableA<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableAT {
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableA<'b>> { ) -> ::flatbuffers::WIPOffset<TableA<'b>> {
let b = self.b.as_ref().map(|x|{ let b = self.b.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Ability, aligned to 4 // struct Ability, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -20,8 +13,8 @@ impl Default for Ability {
Self([0; 8]) Self([0; 8])
} }
} }
impl core::fmt::Debug for Ability { impl ::core::fmt::Debug for Ability {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Ability") f.debug_struct("Ability")
.field("id", &self.id()) .field("id", &self.id())
.field("distance", &self.distance()) .field("distance", &self.distance())
@@ -29,40 +22,39 @@ impl core::fmt::Debug for Ability {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Ability {} impl ::flatbuffers::SimpleToVerifyInSlice for Ability {}
impl<'a> flatbuffers::Follow<'a> for Ability { impl<'a> ::flatbuffers::Follow<'a> for Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Ability>::follow(buf, loc) } unsafe { <&'a Ability>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Ability { impl<'a> ::flatbuffers::Follow<'a> for &'a Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Ability>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Ability>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Ability { impl<'b> ::flatbuffers::Push for Ability {
type Output = Ability; type Output = Ability;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Ability { impl<'a> ::flatbuffers::Verifiable for Ability {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -96,30 +88,30 @@ impl<'a> Ability {
} }
pub fn id(&self) -> u32 { pub fn id(&self) -> u32 {
let mut mem = core::mem::MaybeUninit::<<u32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<u32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_id(&mut self, x: u32) { pub fn set_id(&mut self, x: u32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
@@ -135,30 +127,30 @@ impl<'a> Ability {
key.cmp(&val) key.cmp(&val)
} }
pub fn distance(&self) -> u32 { pub fn distance(&self) -> u32 {
let mut mem = core::mem::MaybeUninit::<<u32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<u32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_distance(&mut self, x: u32) { pub fn set_distance(&mut self, x: u32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<u32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<u32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
@@ -53,8 +46,8 @@ impl AnyAmbiguousAliases {
} }
} }
} }
impl core::fmt::Debug for AnyAmbiguousAliases { impl ::core::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -90,24 +83,24 @@ impl<'de> serde::Deserialize<'de> for AnyAmbiguousAliases {
} }
} }
impl<'a> flatbuffers::Follow<'a> for AnyAmbiguousAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for AnyAmbiguousAliases { impl ::flatbuffers::Push for AnyAmbiguousAliases {
type Output = AnyAmbiguousAliases; type Output = AnyAmbiguousAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for AnyAmbiguousAliases { impl ::flatbuffers::EndianScalar for AnyAmbiguousAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -121,17 +114,16 @@ impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
} }
} }
impl<'a> flatbuffers::Verifiable for AnyAmbiguousAliases { impl<'a> ::flatbuffers::Verifiable for AnyAmbiguousAliases {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
pub struct AnyAmbiguousAliasesUnionTableOffset {} pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -139,9 +131,9 @@ pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum AnyAmbiguousAliasesT { pub enum AnyAmbiguousAliasesT {
NONE, NONE,
M1(Box<MonsterT>), M1(alloc::boxed::Box<MonsterT>),
M2(Box<MonsterT>), M2(alloc::boxed::Box<MonsterT>),
M3(Box<MonsterT>), M3(alloc::boxed::Box<MonsterT>),
} }
impl Default for AnyAmbiguousAliasesT { impl Default for AnyAmbiguousAliasesT {
fn default() -> Self { fn default() -> Self {
@@ -157,7 +149,7 @@ impl AnyAmbiguousAliasesT {
Self::M3(_) => AnyAmbiguousAliases::M3, Self::M3(_) => AnyAmbiguousAliases::M3,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::M1(v) => Some(v.pack(fbb).as_union_value()), Self::M1(v) => Some(v.pack(fbb).as_union_value()),
@@ -166,9 +158,9 @@ impl AnyAmbiguousAliasesT {
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<Box<MonsterT>> { pub fn take_m1(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M1(_) = self { if let Self::M1(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M1(w) = v { if let Self::M1(w) = v {
Some(w) Some(w)
} else { } else {
@@ -187,9 +179,9 @@ impl AnyAmbiguousAliasesT {
if let Self::M1(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v { if let Self::M2(w) = v {
Some(w) Some(w)
} else { } else {
@@ -208,9 +200,9 @@ impl AnyAmbiguousAliasesT {
if let Self::M2(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<Box<MonsterT>> { pub fn take_m3(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M3(_) = self { if let Self::M3(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M3(w) = v { if let Self::M3(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY: u8 = 0;
@@ -53,8 +46,8 @@ impl Any {
} }
} }
} }
impl core::fmt::Debug for Any { impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -90,24 +83,24 @@ impl<'de> serde::Deserialize<'de> for Any {
} }
} }
impl<'a> flatbuffers::Follow<'a> for Any { impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Any { impl ::flatbuffers::Push for Any {
type Output = Any; type Output = Any;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Any { impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -121,17 +114,16 @@ impl flatbuffers::EndianScalar for Any {
} }
} }
impl<'a> flatbuffers::Verifiable for Any { impl<'a> ::flatbuffers::Verifiable for Any {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Any {} impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub struct AnyUnionTableOffset {} pub struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -139,9 +131,9 @@ pub struct AnyUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum AnyT { pub enum AnyT {
NONE, NONE,
Monster(Box<MonsterT>), Monster(alloc::boxed::Box<MonsterT>),
TestSimpleTableWithEnum(Box<TestSimpleTableWithEnumT>), TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>),
MyGameExample2Monster(Box<super::example_2::MonsterT>), MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyT { impl Default for AnyT {
fn default() -> Self { fn default() -> Self {
@@ -157,7 +149,7 @@ impl AnyT {
Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster, 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>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::Monster(v) => Some(v.pack(fbb).as_union_value()), Self::Monster(v) => Some(v.pack(fbb).as_union_value()),
@@ -166,9 +158,9 @@ impl AnyT {
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<Box<MonsterT>> { pub fn take_monster(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::Monster(_) = self { if let Self::Monster(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Monster(w) = v { if let Self::Monster(w) = v {
Some(w) Some(w)
} else { } else {
@@ -187,9 +179,9 @@ impl AnyT {
if let Self::Monster(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> { pub fn take_test_simple_table_with_enum(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self { if let Self::TestSimpleTableWithEnum(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::TestSimpleTableWithEnum(w) = v { if let Self::TestSimpleTableWithEnum(w) = v {
Some(w) Some(w)
} else { } else {
@@ -208,9 +200,9 @@ impl AnyT {
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> { pub fn take_my_game_example_2_monster(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self { if let Self::MyGameExample2Monster(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::MyGameExample2Monster(w) = v { if let Self::MyGameExample2Monster(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
@@ -53,8 +46,8 @@ impl AnyUniqueAliases {
} }
} }
} }
impl core::fmt::Debug for AnyUniqueAliases { impl ::core::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -90,24 +83,24 @@ impl<'de> serde::Deserialize<'de> for AnyUniqueAliases {
} }
} }
impl<'a> flatbuffers::Follow<'a> for AnyUniqueAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for AnyUniqueAliases { impl ::flatbuffers::Push for AnyUniqueAliases {
type Output = AnyUniqueAliases; type Output = AnyUniqueAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for AnyUniqueAliases { impl ::flatbuffers::EndianScalar for AnyUniqueAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -121,17 +114,16 @@ impl flatbuffers::EndianScalar for AnyUniqueAliases {
} }
} }
impl<'a> flatbuffers::Verifiable for AnyUniqueAliases { impl<'a> ::flatbuffers::Verifiable for AnyUniqueAliases {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
pub struct AnyUniqueAliasesUnionTableOffset {} pub struct AnyUniqueAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -139,9 +131,9 @@ pub struct AnyUniqueAliasesUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum AnyUniqueAliasesT { pub enum AnyUniqueAliasesT {
NONE, NONE,
M(Box<MonsterT>), M(alloc::boxed::Box<MonsterT>),
TS(Box<TestSimpleTableWithEnumT>), TS(alloc::boxed::Box<TestSimpleTableWithEnumT>),
M2(Box<super::example_2::MonsterT>), M2(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyUniqueAliasesT { impl Default for AnyUniqueAliasesT {
fn default() -> Self { fn default() -> Self {
@@ -157,7 +149,7 @@ impl AnyUniqueAliasesT {
Self::M2(_) => AnyUniqueAliases::M2, Self::M2(_) => AnyUniqueAliases::M2,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::M(v) => Some(v.pack(fbb).as_union_value()), Self::M(v) => Some(v.pack(fbb).as_union_value()),
@@ -166,9 +158,9 @@ impl AnyUniqueAliasesT {
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<Box<MonsterT>> { pub fn take_m(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M(_) = self { if let Self::M(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M(w) = v { if let Self::M(w) = v {
Some(w) Some(w)
} else { } else {
@@ -187,9 +179,9 @@ impl AnyUniqueAliasesT {
if let Self::M(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> { pub fn take_ts(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self { if let Self::TS(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::TS(w) = v { if let Self::TS(w) = v {
Some(w) Some(w)
} else { } else {
@@ -208,9 +200,9 @@ impl AnyUniqueAliasesT {
if let Self::TS(v) = self { Some(v.as_mut()) } else { None } 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. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v { if let Self::M2(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,19 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_color { mod bitflags_color {
flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
/// Composite components of Monster color. /// Composite components of Monster color.
#[derive(Default, Debug, Clone, Copy, PartialEq)] #[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct Color: u8 { pub struct Color: u8 {
@@ -37,24 +30,24 @@ impl Serialize for Color {
} }
} }
impl<'a> flatbuffers::Follow<'a> for Color { impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self::from_bits_retain(b) Self::from_bits_retain(b)
} }
} }
impl flatbuffers::Push for Color { impl ::flatbuffers::Push for Color {
type Output = Color; type Output = Color;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.bits()); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
} }
} }
impl flatbuffers::EndianScalar for Color { impl ::flatbuffers::EndianScalar for Color {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -68,14 +61,13 @@ impl flatbuffers::EndianScalar for Color {
} }
} }
impl<'a> flatbuffers::Verifiable for Color { impl<'a> ::flatbuffers::Verifiable for Color {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Color {} impl ::flatbuffers::SimpleToVerifyInSlice for Color {}

View File

@@ -1,19 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_long_enum { mod bitflags_long_enum {
flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
#[derive(Default, Debug, Clone, Copy, PartialEq)] #[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct LongEnum: u64 { pub struct LongEnum: u64 {
const LongOne = 2; const LongOne = 2;
@@ -33,24 +26,24 @@ impl Serialize for LongEnum {
} }
} }
impl<'a> flatbuffers::Follow<'a> for LongEnum { impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) };
Self::from_bits_retain(b) Self::from_bits_retain(b)
} }
} }
impl flatbuffers::Push for LongEnum { impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum; type Output = LongEnum;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u64>(dst, self.bits()); } unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
} }
} }
impl flatbuffers::EndianScalar for LongEnum { impl ::flatbuffers::EndianScalar for LongEnum {
type Scalar = u64; type Scalar = u64;
#[inline] #[inline]
fn to_little_endian(self) -> u64 { fn to_little_endian(self) -> u64 {
@@ -64,14 +57,13 @@ impl flatbuffers::EndianScalar for LongEnum {
} }
} }
impl<'a> flatbuffers::Verifiable for LongEnum { impl<'a> ::flatbuffers::Verifiable for LongEnum {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u64::run_verifier(v, pos) u64::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for LongEnum {} impl ::flatbuffers::SimpleToVerifyInSlice for LongEnum {}

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_RACE: i8 = -1;
@@ -53,8 +46,8 @@ impl Race {
} }
} }
} }
impl core::fmt::Debug for Race { impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -90,24 +83,24 @@ impl<'de> serde::Deserialize<'de> for Race {
} }
} }
impl<'a> flatbuffers::Follow<'a> for Race { impl<'a> ::flatbuffers::Follow<'a> for Race {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Race { impl ::flatbuffers::Push for Race {
type Output = Race; type Output = Race;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Race { impl ::flatbuffers::EndianScalar for Race {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -121,14 +114,13 @@ impl flatbuffers::EndianScalar for Race {
} }
} }
impl<'a> flatbuffers::Verifiable for Race { impl<'a> ::flatbuffers::Verifiable for Race {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Race {} impl ::flatbuffers::SimpleToVerifyInSlice for Race {}

View File

@@ -1,47 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum ReferrableOffset {} pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Referrable<'a> { pub struct Referrable<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Referrable<'a> { impl<'a> ::flatbuffers::Follow<'a> for Referrable<'a> {
type Inner = Referrable<'a>; type Inner = Referrable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Referrable<'a> { impl<'a> Referrable<'a> {
pub const VT_ID: flatbuffers::VOffsetT = 4; pub const VT_ID: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.Referrable" "MyGame.Example.Referrable"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Referrable { _tab: table } Referrable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ReferrableArgs args: &'args ReferrableArgs
) -> flatbuffers::WIPOffset<Referrable<'bldr>> { ) -> ::flatbuffers::WIPOffset<Referrable<'bldr>> {
let mut builder = ReferrableBuilder::new(_fbb); let mut builder = ReferrableBuilder::new(_fbb);
builder.add_id(args.id); builder.add_id(args.id);
builder.finish() builder.finish()
@@ -73,12 +66,11 @@ impl<'a> Referrable<'a> {
} }
} }
impl flatbuffers::Verifiable for Referrable<'_> { impl ::flatbuffers::Verifiable for Referrable<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<u64>("id", Self::VT_ID, false)? .visit_field::<u64>("id", Self::VT_ID, false)?
.finish(); .finish();
@@ -108,17 +100,17 @@ impl Serialize for Referrable<'_> {
} }
} }
pub struct ReferrableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct ReferrableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: u64) { pub fn add_id(&mut self, id: u64) {
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0); self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
ReferrableBuilder { ReferrableBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -126,14 +118,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Referrable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Referrable<'_> { impl ::core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Referrable"); let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id()); ds.field("id", &self.id());
ds.finish() ds.finish()
@@ -152,10 +144,10 @@ impl Default for ReferrableT {
} }
} }
impl ReferrableT { impl ReferrableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Referrable<'b>> { ) -> ::flatbuffers::WIPOffset<Referrable<'b>> {
let id = self.id; let id = self.id;
Referrable::create(_fbb, &ReferrableArgs{ Referrable::create(_fbb, &ReferrableArgs{
id, id,

View File

@@ -1,49 +1,42 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum StatOffset {} pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Stat<'a> { pub struct Stat<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Stat<'a> { impl<'a> ::flatbuffers::Follow<'a> for Stat<'a> {
type Inner = Stat<'a>; type Inner = Stat<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Stat<'a> { impl<'a> Stat<'a> {
pub const VT_ID: flatbuffers::VOffsetT = 4; pub const VT_ID: ::flatbuffers::VOffsetT = 4;
pub const VT_VAL: flatbuffers::VOffsetT = 6; pub const VT_VAL: ::flatbuffers::VOffsetT = 6;
pub const VT_COUNT: flatbuffers::VOffsetT = 8; pub const VT_COUNT: ::flatbuffers::VOffsetT = 8;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.Stat" "MyGame.Example.Stat"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Stat { _tab: table } Stat { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args StatArgs<'args> args: &'args StatArgs<'args>
) -> flatbuffers::WIPOffset<Stat<'bldr>> { ) -> ::flatbuffers::WIPOffset<Stat<'bldr>> {
let mut builder = StatBuilder::new(_fbb); let mut builder = StatBuilder::new(_fbb);
builder.add_val(args.val); builder.add_val(args.val);
if let Some(x) = args.id { builder.add_id(x); } if let Some(x) = args.id { builder.add_id(x); }
@@ -53,7 +46,7 @@ impl<'a> Stat<'a> {
pub fn unpack(&self) -> StatT { pub fn unpack(&self) -> StatT {
let id = self.id().map(|x| { let id = self.id().map(|x| {
x.to_string() alloc::string::ToString::to_string(x)
}); });
let val = self.val(); let val = self.val();
let count = self.count(); let count = self.count();
@@ -69,7 +62,7 @@ impl<'a> Stat<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)}
} }
#[inline] #[inline]
pub fn val(&self) -> i64 { pub fn val(&self) -> i64 {
@@ -97,14 +90,13 @@ impl<'a> Stat<'a> {
} }
} }
impl flatbuffers::Verifiable for Stat<'_> { impl ::flatbuffers::Verifiable for Stat<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("id", Self::VT_ID, false)? .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("id", Self::VT_ID, false)?
.visit_field::<i64>("val", Self::VT_VAL, false)? .visit_field::<i64>("val", Self::VT_VAL, false)?
.visit_field::<u16>("count", Self::VT_COUNT, false)? .visit_field::<u16>("count", Self::VT_COUNT, false)?
.finish(); .finish();
@@ -112,7 +104,7 @@ impl flatbuffers::Verifiable for Stat<'_> {
} }
} }
pub struct StatArgs<'a> { pub struct StatArgs<'a> {
pub id: Option<flatbuffers::WIPOffset<&'a str>>, pub id: Option<::flatbuffers::WIPOffset<&'a str>>,
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
@@ -144,14 +136,14 @@ impl Serialize for Stat<'_> {
} }
} }
pub struct StatBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct StatBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { pub fn add_id(&mut self, id: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Stat::VT_ID, id); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
} }
#[inline] #[inline]
pub fn add_val(&mut self, val: i64) { pub fn add_val(&mut self, val: i64) {
@@ -162,7 +154,7 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0); self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
StatBuilder { StatBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -170,14 +162,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Stat<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Stat<'_> { impl ::core::fmt::Debug for Stat<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Stat"); let mut ds = f.debug_struct("Stat");
ds.field("id", &self.id()); ds.field("id", &self.id());
ds.field("val", &self.val()); ds.field("val", &self.val());
@@ -188,7 +180,7 @@ impl core::fmt::Debug for Stat<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct StatT { pub struct StatT {
pub id: Option<String>, pub id: Option<alloc::string::String>,
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
@@ -202,10 +194,10 @@ impl Default for StatT {
} }
} }
impl StatT { impl StatT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Stat<'b>> { ) -> ::flatbuffers::WIPOffset<Stat<'b>> {
let id = self.id.as_ref().map(|x|{ let id = self.id.as_ref().map(|x|{
_fbb.create_string(x) _fbb.create_string(x)
}); });

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct StructOfStructs, aligned to 4 // struct StructOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -20,8 +13,8 @@ impl Default for StructOfStructs {
Self([0; 20]) Self([0; 20])
} }
} }
impl core::fmt::Debug for StructOfStructs { impl ::core::fmt::Debug for StructOfStructs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructs") f.debug_struct("StructOfStructs")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -30,40 +23,39 @@ impl core::fmt::Debug for StructOfStructs {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for StructOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructs {}
impl<'a> flatbuffers::Follow<'a> for StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for StructOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructs {
type Output = StructOfStructs; type Output = StructOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for StructOfStructs { impl<'a> ::flatbuffers::Verifiable for StructOfStructs {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct StructOfStructsOfStructs, aligned to 4 // struct StructOfStructsOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -20,48 +13,47 @@ impl Default for StructOfStructsOfStructs {
Self([0; 20]) Self([0; 20])
} }
} }
impl core::fmt::Debug for StructOfStructsOfStructs { impl ::core::fmt::Debug for StructOfStructsOfStructs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructsOfStructs") f.debug_struct("StructOfStructsOfStructs")
.field("a", &self.a()) .field("a", &self.a())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
impl<'a> flatbuffers::Follow<'a> for StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for StructOfStructsOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructsOfStructs {
type Output = StructOfStructsOfStructs; type Output = StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for StructOfStructsOfStructs { impl<'a> ::flatbuffers::Verifiable for StructOfStructsOfStructs {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Test, aligned to 2 // struct Test, aligned to 2
#[repr(transparent)] #[repr(transparent)]
@@ -20,8 +13,8 @@ impl Default for Test {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Test { impl ::core::fmt::Debug for Test {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Test") f.debug_struct("Test")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -29,40 +22,39 @@ impl core::fmt::Debug for Test {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Test {} impl ::flatbuffers::SimpleToVerifyInSlice for Test {}
impl<'a> flatbuffers::Follow<'a> for Test { impl<'a> ::flatbuffers::Follow<'a> for Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Test>::follow(buf, loc) } unsafe { <&'a Test>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Test { impl<'a> ::flatbuffers::Follow<'a> for &'a Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Test>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Test { impl<'b> ::flatbuffers::Push for Test {
type Output = Test; type Output = Test;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(2) ::flatbuffers::PushAlignment::new(2)
} }
} }
impl<'a> flatbuffers::Verifiable for Test { impl<'a> ::flatbuffers::Verifiable for Test {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -96,59 +88,59 @@ impl<'a> Test {
} }
pub fn a(&self) -> i16 { pub fn a(&self) -> i16 {
let mut mem = core::mem::MaybeUninit::<<i16 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i16 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i16 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i16 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i16) { pub fn set_a(&mut self, x: i16) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i16 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i16 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn b(&self) -> i8 { pub fn b(&self) -> i8 {
let mut mem = core::mem::MaybeUninit::<<i8 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i8 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[2..].as_ptr(), self.0[2..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_b(&mut self, x: i8) { pub fn set_b(&mut self, x: i8) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[2..].as_mut_ptr(), self.0[2..].as_mut_ptr(),
core::mem::size_of::<<i8 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,47 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TestSimpleTableWithEnumOffset {} pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TestSimpleTableWithEnum<'a> { pub struct TestSimpleTableWithEnum<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> { impl<'a> ::flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
type Inner = TestSimpleTableWithEnum<'a>; type Inner = TestSimpleTableWithEnum<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TestSimpleTableWithEnum<'a> { impl<'a> TestSimpleTableWithEnum<'a> {
pub const VT_COLOR: flatbuffers::VOffsetT = 4; pub const VT_COLOR: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.TestSimpleTableWithEnum" "MyGame.Example.TestSimpleTableWithEnum"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TestSimpleTableWithEnum { _tab: table } TestSimpleTableWithEnum { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TestSimpleTableWithEnumArgs args: &'args TestSimpleTableWithEnumArgs
) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> { ) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'bldr>> {
let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb); let mut builder = TestSimpleTableWithEnumBuilder::new(_fbb);
builder.add_color(args.color); builder.add_color(args.color);
builder.finish() builder.finish()
@@ -63,12 +56,11 @@ impl<'a> TestSimpleTableWithEnum<'a> {
} }
} }
impl flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> { impl ::flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<Color>("color", Self::VT_COLOR, false)? .visit_field::<Color>("color", Self::VT_COLOR, false)?
.finish(); .finish();
@@ -98,17 +90,17 @@ impl Serialize for TestSimpleTableWithEnum<'_> {
} }
} }
pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green); self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TestSimpleTableWithEnumBuilder { TestSimpleTableWithEnumBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -116,14 +108,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TestSimpleTableWithEnum<'_> { impl ::core::fmt::Debug for TestSimpleTableWithEnum<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TestSimpleTableWithEnum"); let mut ds = f.debug_struct("TestSimpleTableWithEnum");
ds.field("color", &self.color()); ds.field("color", &self.color());
ds.finish() ds.finish()
@@ -142,10 +134,10 @@ impl Default for TestSimpleTableWithEnumT {
} }
} }
impl TestSimpleTableWithEnumT { impl TestSimpleTableWithEnumT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>> { ) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'b>> {
let color = self.color; let color = self.color;
TestSimpleTableWithEnum::create(_fbb, &TestSimpleTableWithEnumArgs{ TestSimpleTableWithEnum::create(_fbb, &TestSimpleTableWithEnumArgs{
color, color,

View File

@@ -1,58 +1,51 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TypeAliasesOffset {} pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TypeAliases<'a> { pub struct TypeAliases<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> { impl<'a> ::flatbuffers::Follow<'a> for TypeAliases<'a> {
type Inner = TypeAliases<'a>; type Inner = TypeAliases<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TypeAliases<'a> { impl<'a> TypeAliases<'a> {
pub const VT_I8_: flatbuffers::VOffsetT = 4; pub const VT_I8_: ::flatbuffers::VOffsetT = 4;
pub const VT_U8_: flatbuffers::VOffsetT = 6; pub const VT_U8_: ::flatbuffers::VOffsetT = 6;
pub const VT_I16_: flatbuffers::VOffsetT = 8; pub const VT_I16_: ::flatbuffers::VOffsetT = 8;
pub const VT_U16_: flatbuffers::VOffsetT = 10; pub const VT_U16_: ::flatbuffers::VOffsetT = 10;
pub const VT_I32_: flatbuffers::VOffsetT = 12; pub const VT_I32_: ::flatbuffers::VOffsetT = 12;
pub const VT_U32_: flatbuffers::VOffsetT = 14; pub const VT_U32_: ::flatbuffers::VOffsetT = 14;
pub const VT_I64_: flatbuffers::VOffsetT = 16; pub const VT_I64_: ::flatbuffers::VOffsetT = 16;
pub const VT_U64_: flatbuffers::VOffsetT = 18; pub const VT_U64_: ::flatbuffers::VOffsetT = 18;
pub const VT_F32_: flatbuffers::VOffsetT = 20; pub const VT_F32_: ::flatbuffers::VOffsetT = 20;
pub const VT_F64_: flatbuffers::VOffsetT = 22; pub const VT_F64_: ::flatbuffers::VOffsetT = 22;
pub const VT_V8: flatbuffers::VOffsetT = 24; pub const VT_V8: ::flatbuffers::VOffsetT = 24;
pub const VT_VF64: flatbuffers::VOffsetT = 26; pub const VT_VF64: ::flatbuffers::VOffsetT = 26;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.TypeAliases" "MyGame.Example.TypeAliases"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TypeAliases { _tab: table } TypeAliases { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TypeAliasesArgs<'args> args: &'args TypeAliasesArgs<'args>
) -> flatbuffers::WIPOffset<TypeAliases<'bldr>> { ) -> ::flatbuffers::WIPOffset<TypeAliases<'bldr>> {
let mut builder = TypeAliasesBuilder::new(_fbb); let mut builder = TypeAliasesBuilder::new(_fbb);
builder.add_f64_(args.f64_); builder.add_f64_(args.f64_);
builder.add_u64_(args.u64_); builder.add_u64_(args.u64_);
@@ -173,27 +166,26 @@ impl<'a> TypeAliases<'a> {
unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()} unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn v8(&self) -> Option<flatbuffers::Vector<'a, i8>> { pub fn v8(&self) -> Option<::flatbuffers::Vector<'a, i8>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)}
} }
#[inline] #[inline]
pub fn vf64(&self) -> Option<flatbuffers::Vector<'a, f64>> { pub fn vf64(&self) -> Option<::flatbuffers::Vector<'a, f64>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(TypeAliases::VT_VF64, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f64>>>(TypeAliases::VT_VF64, None)}
} }
} }
impl flatbuffers::Verifiable for TypeAliases<'_> { impl ::flatbuffers::Verifiable for TypeAliases<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i8>("i8_", Self::VT_I8_, false)? .visit_field::<i8>("i8_", Self::VT_I8_, false)?
.visit_field::<u8>("u8_", Self::VT_U8_, false)? .visit_field::<u8>("u8_", Self::VT_U8_, false)?
@@ -205,8 +197,8 @@ impl flatbuffers::Verifiable for TypeAliases<'_> {
.visit_field::<u64>("u64_", Self::VT_U64_, false)? .visit_field::<u64>("u64_", Self::VT_U64_, false)?
.visit_field::<f32>("f32_", Self::VT_F32_, false)? .visit_field::<f32>("f32_", Self::VT_F32_, false)?
.visit_field::<f64>("f64_", Self::VT_F64_, false)? .visit_field::<f64>("f64_", Self::VT_F64_, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i8>>>("v8", Self::VT_V8, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, i8>>>("v8", Self::VT_V8, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("vf64", Self::VT_VF64, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f64>>>("vf64", Self::VT_VF64, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
@@ -222,8 +214,8 @@ pub struct TypeAliasesArgs<'a> {
pub u64_: u64, pub u64_: u64,
pub f32_: f32, pub f32_: f32,
pub f64_: f64, pub f64_: f64,
pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i8>>>, pub v8: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i8>>>,
pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>, pub vf64: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f64>>>,
} }
impl<'a> Default for TypeAliasesArgs<'a> { impl<'a> Default for TypeAliasesArgs<'a> {
#[inline] #[inline]
@@ -275,11 +267,11 @@ impl Serialize for TypeAliases<'_> {
} }
} }
pub struct TypeAliasesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TypeAliasesBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_i8_(&mut self, i8_: i8) { pub fn add_i8_(&mut self, i8_: i8) {
self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0); self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
@@ -321,15 +313,15 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0); self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
} }
#[inline] #[inline]
pub fn add_v8(&mut self, v8: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>) { pub fn add_v8(&mut self, v8: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
} }
#[inline] #[inline]
pub fn add_vf64(&mut self, vf64: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) { pub fn add_vf64(&mut self, vf64: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TypeAliasesBuilder { TypeAliasesBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -337,14 +329,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TypeAliases<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TypeAliases<'_> { impl ::core::fmt::Debug for TypeAliases<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TypeAliases"); let mut ds = f.debug_struct("TypeAliases");
ds.field("i8_", &self.i8_()); ds.field("i8_", &self.i8_());
ds.field("u8_", &self.u8_()); ds.field("u8_", &self.u8_());
@@ -374,8 +366,8 @@ pub struct TypeAliasesT {
pub u64_: u64, pub u64_: u64,
pub f32_: f32, pub f32_: f32,
pub f64_: f64, pub f64_: f64,
pub v8: Option<Vec<i8>>, pub v8: Option<alloc::vec::Vec<i8>>,
pub vf64: Option<Vec<f64>>, pub vf64: Option<alloc::vec::Vec<f64>>,
} }
impl Default for TypeAliasesT { impl Default for TypeAliasesT {
fn default() -> Self { fn default() -> Self {
@@ -396,10 +388,10 @@ impl Default for TypeAliasesT {
} }
} }
impl TypeAliasesT { impl TypeAliasesT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TypeAliases<'b>> { ) -> ::flatbuffers::WIPOffset<TypeAliases<'b>> {
let i8_ = self.i8_; let i8_ = self.i8_;
let u8_ = self.u8_; let u8_ = self.u8_;
let i16_ = self.i16_; let i16_ = self.i16_;

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Vec3, aligned to 8 // struct Vec3, aligned to 8
#[repr(transparent)] #[repr(transparent)]
@@ -20,8 +13,8 @@ impl Default for Vec3 {
Self([0; 32]) Self([0; 32])
} }
} }
impl core::fmt::Debug for Vec3 { impl ::core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Vec3") f.debug_struct("Vec3")
.field("x", &self.x()) .field("x", &self.x())
.field("y", &self.y()) .field("y", &self.y())
@@ -33,40 +26,39 @@ impl core::fmt::Debug for Vec3 {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Vec3 {} impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {}
impl<'a> flatbuffers::Follow<'a> for Vec3 { impl<'a> ::flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Vec3>::follow(buf, loc) } unsafe { <&'a Vec3>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Vec3 { impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Vec3>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Vec3 { impl<'b> ::flatbuffers::Push for Vec3 {
type Output = Vec3; type Output = Vec3;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
} }
} }
impl<'a> flatbuffers::Verifiable for Vec3 { impl<'a> ::flatbuffers::Verifiable for Vec3 {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -112,146 +104,146 @@ impl<'a> Vec3 {
} }
pub fn x(&self) -> f32 { pub fn x(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_x(&mut self, x: f32) { pub fn set_x(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn y(&self) -> f32 { pub fn y(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_y(&mut self, x: f32) { pub fn set_y(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn z(&self) -> f32 { pub fn z(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(), self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_z(&mut self, x: f32) { pub fn set_z(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[8..].as_mut_ptr(), self.0[8..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn test1(&self) -> f64 { pub fn test1(&self) -> f64 {
let mut mem = core::mem::MaybeUninit::<<f64 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f64 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[16..].as_ptr(), self.0[16..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f64 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f64 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_test1(&mut self, x: f64) { pub fn set_test1(&mut self, x: f64) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[16..].as_mut_ptr(), self.0[16..].as_mut_ptr(),
core::mem::size_of::<<f64 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f64 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn test2(&self) -> Color { pub fn test2(&self) -> Color {
let mut mem = core::mem::MaybeUninit::<<Color as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<Color as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[24..].as_ptr(), self.0[24..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<Color as EndianScalar>::Scalar>(), ::core::mem::size_of::<<Color as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_test2(&mut self, x: Color) { pub fn set_test2(&mut self, x: Color) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[24..].as_mut_ptr(), self.0[24..].as_mut_ptr(),
core::mem::size_of::<<Color as EndianScalar>::Scalar>(), ::core::mem::size_of::<<Color as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,28 +1,21 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum MonsterOffset {} pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -33,14 +26,14 @@ impl<'a> Monster<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args MonsterArgs _args: &'args MonsterArgs
) -> flatbuffers::WIPOffset<Monster<'bldr>> { ) -> ::flatbuffers::WIPOffset<Monster<'bldr>> {
let mut builder = MonsterBuilder::new(_fbb); let mut builder = MonsterBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -51,12 +44,11 @@ impl<'a> Monster<'a> {
} }
} }
impl flatbuffers::Verifiable for Monster<'_> { impl ::flatbuffers::Verifiable for Monster<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -82,13 +74,13 @@ impl Serialize for Monster<'_> {
} }
} }
pub struct MonsterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
MonsterBuilder { MonsterBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -96,14 +88,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Monster<'_> { impl ::core::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Monster"); let mut ds = f.debug_struct("Monster");
ds.finish() ds.finish()
} }
@@ -119,10 +111,10 @@ impl Default for MonsterT {
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Monster<'b>> { ) -> ::flatbuffers::WIPOffset<Monster<'b>> {
Monster::create(_fbb, &MonsterArgs{ Monster::create(_fbb, &MonsterArgs{
}) })
} }

View File

@@ -1,28 +1,21 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum InParentNamespaceOffset {} pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct InParentNamespace<'a> { pub struct InParentNamespace<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> { impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
type Inner = InParentNamespace<'a>; type Inner = InParentNamespace<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -33,14 +26,14 @@ impl<'a> InParentNamespace<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
InParentNamespace { _tab: table } InParentNamespace { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args InParentNamespaceArgs _args: &'args InParentNamespaceArgs
) -> flatbuffers::WIPOffset<InParentNamespace<'bldr>> { ) -> ::flatbuffers::WIPOffset<InParentNamespace<'bldr>> {
let mut builder = InParentNamespaceBuilder::new(_fbb); let mut builder = InParentNamespaceBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -51,12 +44,11 @@ impl<'a> InParentNamespace<'a> {
} }
} }
impl flatbuffers::Verifiable for InParentNamespace<'_> { impl ::flatbuffers::Verifiable for InParentNamespace<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -82,13 +74,13 @@ impl Serialize for InParentNamespace<'_> {
} }
} }
pub struct InParentNamespaceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct InParentNamespaceBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
InParentNamespaceBuilder { InParentNamespaceBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -96,14 +88,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<InParentNamespace<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for InParentNamespace<'_> { impl ::core::fmt::Debug for InParentNamespace<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("InParentNamespace"); let mut ds = f.debug_struct("InParentNamespace");
ds.finish() ds.finish()
} }
@@ -119,10 +111,10 @@ impl Default for InParentNamespaceT {
} }
} }
impl InParentNamespaceT { impl InParentNamespaceT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<InParentNamespace<'b>> { ) -> ::flatbuffers::WIPOffset<InParentNamespace<'b>> {
InParentNamespace::create(_fbb, &InParentNamespaceArgs{ InParentNamespace::create(_fbb, &InParentNamespaceArgs{
}) })
} }

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -41,8 +34,8 @@ impl FromInclude {
} }
} }
} }
impl core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -78,24 +71,24 @@ impl<'de> serde::Deserialize<'de> for FromInclude {
} }
} }
impl<'a> flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
@@ -109,14 +102,13 @@ impl flatbuffers::EndianScalar for FromInclude {
} }
} }
impl<'a> flatbuffers::Verifiable for FromInclude { impl<'a> ::flatbuffers::Verifiable for FromInclude {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i64::run_verifier(v, pos) i64::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for FromInclude {} impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}

View File

@@ -1,47 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableBOffset {} pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableB<'a> { impl<'a> TableB<'a> {
pub const VT_A: flatbuffers::VOffsetT = 4; pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB" "MyGame.OtherNameSpace.TableB"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args> args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb); let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); } if let Some(x) = args.a { builder.add_a(x); }
builder.finish() builder.finish()
@@ -49,7 +42,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT { pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| { let a = self.a().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableBT { TableBT {
a, a,
@@ -61,24 +54,23 @@ impl<'a> TableB<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
} }
} }
impl flatbuffers::Verifiable for TableB<'_> { impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
@@ -104,17 +96,17 @@ impl Serialize for TableB<'_> {
} }
} }
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableBBuilder { TableBBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -122,14 +114,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableB<'_> { impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB"); let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a()); ds.field("a", &self.a());
ds.finish() ds.finish()
@@ -138,7 +130,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
@@ -148,10 +140,10 @@ impl Default for TableBT {
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> { ) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{ let a = self.a.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,15 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -20,48 +13,47 @@ impl Default for Unused {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
.field("a", &self.a()) .field("a", &self.a())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { 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()) }; 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); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Unused { impl<'a> ::flatbuffers::Verifiable for Unused {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -92,30 +84,30 @@ impl<'a> Unused {
} }
pub fn a(&self) -> i32 { pub fn a(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i32) { pub fn set_a(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,47 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableAOffset {} pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableA<'a> { impl<'a> TableA<'a> {
pub const VT_B: flatbuffers::VOffsetT = 4; pub const VT_B: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"TableA" "TableA"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableAArgs<'args> args: &'args TableAArgs<'args>
) -> flatbuffers::WIPOffset<TableA<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableA<'bldr>> {
let mut builder = TableABuilder::new(_fbb); let mut builder = TableABuilder::new(_fbb);
if let Some(x) = args.b { builder.add_b(x); } if let Some(x) = args.b { builder.add_b(x); }
builder.finish() builder.finish()
@@ -49,7 +42,7 @@ impl<'a> TableA<'a> {
pub fn unpack(&self) -> TableAT { pub fn unpack(&self) -> TableAT {
let b = self.b().map(|x| { let b = self.b().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableAT { TableAT {
b, b,
@@ -61,24 +54,23 @@ impl<'a> TableA<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>(TableA::VT_B, None)}
} }
} }
impl flatbuffers::Verifiable for TableA<'_> { impl ::flatbuffers::Verifiable for TableA<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)? .visit_field::<::flatbuffers::ForwardsUOffset<my_game::other_name_space::TableB>>("b", Self::VT_B, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
@@ -104,17 +96,17 @@ impl Serialize for TableA<'_> {
} }
} }
pub struct TableABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { 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); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableABuilder { TableABuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -122,14 +114,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableA<'_> { impl ::core::fmt::Debug for TableA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableA"); let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b()); ds.field("b", &self.b());
ds.finish() ds.finish()
@@ -138,7 +130,7 @@ impl core::fmt::Debug for TableA<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
@@ -148,10 +140,10 @@ impl Default for TableAT {
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableA<'b>> { ) -> ::flatbuffers::WIPOffset<TableA<'b>> {
let b = self.b.as_ref().map(|x|{ let b = self.b.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ABC: i32 = 0; pub const ENUM_MIN_ABC: i32 = 0;
@@ -47,8 +40,8 @@ impl ABC {
} }
} }
} }
impl core::fmt::Debug for ABC { impl ::core::fmt::Debug for ABC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for ABC {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for ABC { impl<'a> ::flatbuffers::Follow<'a> for ABC {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i32>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for ABC { impl ::flatbuffers::Push for ABC {
type Output = ABC; type Output = ABC;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i32>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for ABC { impl ::flatbuffers::EndianScalar for ABC {
type Scalar = i32; type Scalar = i32;
#[inline] #[inline]
fn to_little_endian(self) -> i32 { fn to_little_endian(self) -> i32 {
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for ABC {
} }
} }
impl<'a> flatbuffers::Verifiable for ABC { impl<'a> ::flatbuffers::Verifiable for ABC {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i32::run_verifier(v, pos) i32::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for ABC {} impl ::flatbuffers::SimpleToVerifyInSlice for ABC {}

View File

@@ -1,50 +1,43 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum MoreDefaultsOffset {} pub enum MoreDefaultsOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct MoreDefaults<'a> { pub struct MoreDefaults<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for MoreDefaults<'a> { impl<'a> ::flatbuffers::Follow<'a> for MoreDefaults<'a> {
type Inner = MoreDefaults<'a>; type Inner = MoreDefaults<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> MoreDefaults<'a> { impl<'a> MoreDefaults<'a> {
pub const VT_INTS: flatbuffers::VOffsetT = 4; pub const VT_INTS: ::flatbuffers::VOffsetT = 4;
pub const VT_FLOATS: flatbuffers::VOffsetT = 6; pub const VT_FLOATS: ::flatbuffers::VOffsetT = 6;
pub const VT_EMPTY_STRING: flatbuffers::VOffsetT = 8; pub const VT_EMPTY_STRING: ::flatbuffers::VOffsetT = 8;
pub const VT_SOME_STRING: flatbuffers::VOffsetT = 10; pub const VT_SOME_STRING: ::flatbuffers::VOffsetT = 10;
pub const VT_ABCS: flatbuffers::VOffsetT = 12; pub const VT_ABCS: ::flatbuffers::VOffsetT = 12;
pub const VT_BOOLS: flatbuffers::VOffsetT = 14; pub const VT_BOOLS: ::flatbuffers::VOffsetT = 14;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MoreDefaults" "MoreDefaults"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
MoreDefaults { _tab: table } MoreDefaults { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args MoreDefaultsArgs<'args> args: &'args MoreDefaultsArgs<'args>
) -> flatbuffers::WIPOffset<MoreDefaults<'bldr>> { ) -> ::flatbuffers::WIPOffset<MoreDefaults<'bldr>> {
let mut builder = MoreDefaultsBuilder::new(_fbb); let mut builder = MoreDefaultsBuilder::new(_fbb);
if let Some(x) = args.bools { builder.add_bools(x); } if let Some(x) = args.bools { builder.add_bools(x); }
if let Some(x) = args.abcs { builder.add_abcs(x); } if let Some(x) = args.abcs { builder.add_abcs(x); }
@@ -66,11 +59,11 @@ impl<'a> MoreDefaults<'a> {
}; };
let empty_string = { let empty_string = {
let x = self.empty_string(); let x = self.empty_string();
x.to_string() alloc::string::ToString::to_string(x)
}; };
let some_string = { let some_string = {
let x = self.some_string(); let x = self.some_string();
x.to_string() alloc::string::ToString::to_string(x)
}; };
let abcs = { let abcs = {
let x = self.abcs(); let x = self.abcs();
@@ -91,73 +84,72 @@ impl<'a> MoreDefaults<'a> {
} }
#[inline] #[inline]
pub fn ints(&self) -> flatbuffers::Vector<'a, i32> { pub fn ints(&self) -> ::flatbuffers::Vector<'a, i32> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i32>>>(MoreDefaults::VT_INTS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i32>>>(MoreDefaults::VT_INTS, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn floats(&self) -> flatbuffers::Vector<'a, f32> { pub fn floats(&self) -> ::flatbuffers::Vector<'a, f32> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f32>>>(MoreDefaults::VT_FLOATS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(MoreDefaults::VT_FLOATS, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn empty_string(&self) -> &'a str { pub fn empty_string(&self) -> &'a str {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_EMPTY_STRING, Some(&"")).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_EMPTY_STRING, Some(&"")).unwrap()}
} }
#[inline] #[inline]
pub fn some_string(&self) -> &'a str { pub fn some_string(&self) -> &'a str {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_SOME_STRING, Some(&"some")).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_SOME_STRING, Some(&"some")).unwrap()}
} }
#[inline] #[inline]
pub fn abcs(&self) -> flatbuffers::Vector<'a, ABC> { pub fn abcs(&self) -> ::flatbuffers::Vector<'a, ABC> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, ABC>>>(MoreDefaults::VT_ABCS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ABC>>>(MoreDefaults::VT_ABCS, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn bools(&self) -> flatbuffers::Vector<'a, bool> { pub fn bools(&self) -> ::flatbuffers::Vector<'a, bool> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, bool>>>(MoreDefaults::VT_BOOLS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, bool>>>(MoreDefaults::VT_BOOLS, Some(Default::default())).unwrap()}
} }
} }
impl flatbuffers::Verifiable for MoreDefaults<'_> { impl ::flatbuffers::Verifiable for MoreDefaults<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i32>>>("ints", Self::VT_INTS, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, i32>>>("ints", Self::VT_INTS, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f32>>>("floats", Self::VT_FLOATS, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("floats", Self::VT_FLOATS, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("empty_string", Self::VT_EMPTY_STRING, false)? .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("empty_string", Self::VT_EMPTY_STRING, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("some_string", Self::VT_SOME_STRING, false)? .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("some_string", Self::VT_SOME_STRING, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, ABC>>>("abcs", Self::VT_ABCS, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ABC>>>("abcs", Self::VT_ABCS, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, bool>>>("bools", Self::VT_BOOLS, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, bool>>>("bools", Self::VT_BOOLS, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct MoreDefaultsArgs<'a> { pub struct MoreDefaultsArgs<'a> {
pub ints: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i32>>>, pub ints: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i32>>>,
pub floats: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f32>>>, pub floats: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
pub empty_string: Option<flatbuffers::WIPOffset<&'a str>>, pub empty_string: Option<::flatbuffers::WIPOffset<&'a str>>,
pub some_string: Option<flatbuffers::WIPOffset<&'a str>>, pub some_string: Option<::flatbuffers::WIPOffset<&'a str>>,
pub abcs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, ABC>>>, pub abcs: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ABC>>>,
pub bools: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, bool>>>, pub bools: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, bool>>>,
} }
impl<'a> Default for MoreDefaultsArgs<'a> { impl<'a> Default for MoreDefaultsArgs<'a> {
#[inline] #[inline]
@@ -173,37 +165,37 @@ impl<'a> Default for MoreDefaultsArgs<'a> {
} }
} }
pub struct MoreDefaultsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct MoreDefaultsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MoreDefaultsBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MoreDefaultsBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_ints(&mut self, ints: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i32>>) { pub fn add_ints(&mut self, ints: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i32>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MoreDefaults::VT_INTS, ints); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_INTS, ints);
} }
#[inline] #[inline]
pub fn add_floats(&mut self, floats: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f32>>) { pub fn add_floats(&mut self, floats: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MoreDefaults::VT_FLOATS, floats); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_FLOATS, floats);
} }
#[inline] #[inline]
pub fn add_empty_string(&mut self, empty_string: flatbuffers::WIPOffset<&'b str>) { pub fn add_empty_string(&mut self, empty_string: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MoreDefaults::VT_EMPTY_STRING, empty_string); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_EMPTY_STRING, empty_string);
} }
#[inline] #[inline]
pub fn add_some_string(&mut self, some_string: flatbuffers::WIPOffset<&'b str>) { pub fn add_some_string(&mut self, some_string: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MoreDefaults::VT_SOME_STRING, some_string); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_SOME_STRING, some_string);
} }
#[inline] #[inline]
pub fn add_abcs(&mut self, abcs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , ABC>>) { pub fn add_abcs(&mut self, abcs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ABC>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MoreDefaults::VT_ABCS, abcs); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_ABCS, abcs);
} }
#[inline] #[inline]
pub fn add_bools(&mut self, bools: flatbuffers::WIPOffset<flatbuffers::Vector<'b , bool>>) { pub fn add_bools(&mut self, bools: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , bool>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MoreDefaults::VT_BOOLS, bools); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_BOOLS, bools);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MoreDefaultsBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MoreDefaultsBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
MoreDefaultsBuilder { MoreDefaultsBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -211,14 +203,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MoreDefaultsBuilder<'a, 'b, A>
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<MoreDefaults<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<MoreDefaults<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for MoreDefaults<'_> { impl ::core::fmt::Debug for MoreDefaults<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("MoreDefaults"); let mut ds = f.debug_struct("MoreDefaults");
ds.field("ints", &self.ints()); ds.field("ints", &self.ints());
ds.field("floats", &self.floats()); ds.field("floats", &self.floats());
@@ -232,30 +224,30 @@ impl core::fmt::Debug for MoreDefaults<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct MoreDefaultsT { pub struct MoreDefaultsT {
pub ints: Vec<i32>, pub ints: alloc::vec::Vec<i32>,
pub floats: Vec<f32>, pub floats: alloc::vec::Vec<f32>,
pub empty_string: String, pub empty_string: alloc::string::String,
pub some_string: String, pub some_string: alloc::string::String,
pub abcs: Vec<ABC>, pub abcs: alloc::vec::Vec<ABC>,
pub bools: Vec<bool>, pub bools: alloc::vec::Vec<bool>,
} }
impl Default for MoreDefaultsT { impl Default for MoreDefaultsT {
fn default() -> Self { fn default() -> Self {
Self { Self {
ints: Default::default(), ints: Default::default(),
floats: Default::default(), floats: Default::default(),
empty_string: "".to_string(), empty_string: alloc::string::ToString::to_string(""),
some_string: "some".to_string(), some_string: alloc::string::ToString::to_string("some"),
abcs: Default::default(), abcs: Default::default(),
bools: Default::default(), bools: Default::default(),
} }
} }
} }
impl MoreDefaultsT { impl MoreDefaultsT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<MoreDefaults<'b>> { ) -> ::flatbuffers::WIPOffset<MoreDefaults<'b>> {
let ints = Some({ let ints = Some({
let x = &self.ints; let x = &self.ints;
_fbb.create_vector(x) _fbb.create_vector(x)

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0; pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
@@ -47,8 +40,8 @@ impl EnumInNestedNS {
} }
} }
} }
impl core::fmt::Debug for EnumInNestedNS { impl ::core::fmt::Debug for EnumInNestedNS {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for EnumInNestedNS {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for EnumInNestedNS {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for EnumInNestedNS { impl ::flatbuffers::Push for EnumInNestedNS {
type Output = EnumInNestedNS; type Output = EnumInNestedNS;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for EnumInNestedNS { impl ::flatbuffers::EndianScalar for EnumInNestedNS {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for EnumInNestedNS {
} }
} }
impl<'a> flatbuffers::Verifiable for EnumInNestedNS { impl<'a> ::flatbuffers::Verifiable for EnumInNestedNS {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for EnumInNestedNS {} impl ::flatbuffers::SimpleToVerifyInSlice for EnumInNestedNS {}

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct StructInNestedNS, aligned to 4 // struct StructInNestedNS, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for StructInNestedNS {
Self([0; 8]) Self([0; 8])
} }
} }
impl core::fmt::Debug for StructInNestedNS { impl ::core::fmt::Debug for StructInNestedNS {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructInNestedNS") f.debug_struct("StructInNestedNS")
.field("a", &self.a()) .field("a", &self.a())
.field("b", &self.b()) .field("b", &self.b())
@@ -27,40 +20,39 @@ impl core::fmt::Debug for StructInNestedNS {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {} impl ::flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {}
impl<'a> flatbuffers::Follow<'a> for StructInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for StructInNestedNS {
type Inner = &'a StructInNestedNS; type Inner = &'a StructInNestedNS;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructInNestedNS>::follow(buf, loc) } unsafe { <&'a StructInNestedNS>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a StructInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for &'a StructInNestedNS {
type Inner = &'a StructInNestedNS; type Inner = &'a StructInNestedNS;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for StructInNestedNS { impl<'b> ::flatbuffers::Push for StructInNestedNS {
type Output = StructInNestedNS; type Output = StructInNestedNS;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, <Self as flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for StructInNestedNS { impl<'a> ::flatbuffers::Verifiable for StructInNestedNS {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -82,59 +74,59 @@ impl<'a> StructInNestedNS {
} }
pub fn a(&self) -> i32 { pub fn a(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_a(&mut self, x: i32) { pub fn set_a(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn b(&self) -> i32 { pub fn b(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_b(&mut self, x: i32) { pub fn set_b(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableInNestedNSOffset {} pub enum TableInNestedNSOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableInNestedNS<'a> { pub struct TableInNestedNS<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableInNestedNS<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableInNestedNS<'a> {
type Inner = TableInNestedNS<'a>; type Inner = TableInNestedNS<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableInNestedNS<'a> { impl<'a> TableInNestedNS<'a> {
pub const VT_FOO: flatbuffers::VOffsetT = 4; pub const VT_FOO: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"NamespaceA.NamespaceB.TableInNestedNS" "NamespaceA.NamespaceB.TableInNestedNS"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableInNestedNS { _tab: table } TableInNestedNS { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableInNestedNSArgs args: &'args TableInNestedNSArgs
) -> flatbuffers::WIPOffset<TableInNestedNS<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
let mut builder = TableInNestedNSBuilder::new(_fbb); let mut builder = TableInNestedNSBuilder::new(_fbb);
builder.add_foo(args.foo); builder.add_foo(args.foo);
builder.finish() builder.finish()
@@ -61,12 +54,11 @@ impl<'a> TableInNestedNS<'a> {
} }
} }
impl flatbuffers::Verifiable for TableInNestedNS<'_> { impl ::flatbuffers::Verifiable for TableInNestedNS<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i32>("foo", Self::VT_FOO, false)? .visit_field::<i32>("foo", Self::VT_FOO, false)?
.finish(); .finish();
@@ -85,17 +77,17 @@ impl<'a> Default for TableInNestedNSArgs {
} }
} }
pub struct TableInNestedNSBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableInNestedNSBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_foo(&mut self, foo: i32) { pub fn add_foo(&mut self, foo: i32) {
self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0); self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableInNestedNSBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInNestedNSBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableInNestedNSBuilder { TableInNestedNSBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableInNestedNS<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInNestedNS<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableInNestedNS<'_> { impl ::core::fmt::Debug for TableInNestedNS<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableInNestedNS"); let mut ds = f.debug_struct("TableInNestedNS");
ds.field("foo", &self.foo()); ds.field("foo", &self.foo());
ds.finish() ds.finish()
@@ -129,10 +121,10 @@ impl Default for TableInNestedNST {
} }
} }
impl TableInNestedNST { impl TableInNestedNST {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableInNestedNS<'b>> { ) -> ::flatbuffers::WIPOffset<TableInNestedNS<'b>> {
let foo = self.foo; let foo = self.foo;
TableInNestedNS::create(_fbb, &TableInNestedNSArgs{ TableInNestedNS::create(_fbb, &TableInNestedNSArgs{
foo, foo,

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0; pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0;
@@ -43,8 +36,8 @@ impl UnionInNestedNS {
} }
} }
} }
impl core::fmt::Debug for UnionInNestedNS { impl ::core::fmt::Debug for UnionInNestedNS {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -52,24 +45,24 @@ impl core::fmt::Debug for UnionInNestedNS {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for UnionInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for UnionInNestedNS {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for UnionInNestedNS { impl ::flatbuffers::Push for UnionInNestedNS {
type Output = UnionInNestedNS; type Output = UnionInNestedNS;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for UnionInNestedNS { impl ::flatbuffers::EndianScalar for UnionInNestedNS {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -83,17 +76,16 @@ impl flatbuffers::EndianScalar for UnionInNestedNS {
} }
} }
impl<'a> flatbuffers::Verifiable for UnionInNestedNS { impl<'a> ::flatbuffers::Verifiable for UnionInNestedNS {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {} impl ::flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {}
pub struct UnionInNestedNSUnionTableOffset {} pub struct UnionInNestedNSUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -101,7 +93,7 @@ pub struct UnionInNestedNSUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum UnionInNestedNST { pub enum UnionInNestedNST {
NONE, NONE,
TableInNestedNS(Box<TableInNestedNST>), TableInNestedNS(alloc::boxed::Box<TableInNestedNST>),
} }
impl Default for UnionInNestedNST { impl Default for UnionInNestedNST {
fn default() -> Self { fn default() -> Self {
@@ -115,16 +107,16 @@ impl UnionInNestedNST {
Self::TableInNestedNS(_) => UnionInNestedNS::TableInNestedNS, Self::TableInNestedNS(_) => UnionInNestedNS::TableInNestedNS,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()), Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE. /// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE.
pub fn take_table_in_nested_ns(&mut self) -> Option<Box<TableInNestedNST>> { pub fn take_table_in_nested_ns(&mut self) -> Option<alloc::boxed::Box<TableInNestedNST>> {
if let Self::TableInNestedNS(_) = self { if let Self::TableInNestedNS(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::TableInNestedNS(w) = v { if let Self::TableInNestedNS(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum SecondTableInAOffset {} pub enum SecondTableInAOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct SecondTableInA<'a> { pub struct SecondTableInA<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for SecondTableInA<'a> { impl<'a> ::flatbuffers::Follow<'a> for SecondTableInA<'a> {
type Inner = SecondTableInA<'a>; type Inner = SecondTableInA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> SecondTableInA<'a> { impl<'a> SecondTableInA<'a> {
pub const VT_REFER_TO_C: flatbuffers::VOffsetT = 4; pub const VT_REFER_TO_C: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"NamespaceA.SecondTableInA" "NamespaceA.SecondTableInA"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
SecondTableInA { _tab: table } SecondTableInA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args SecondTableInAArgs<'args> args: &'args SecondTableInAArgs<'args>
) -> flatbuffers::WIPOffset<SecondTableInA<'bldr>> { ) -> ::flatbuffers::WIPOffset<SecondTableInA<'bldr>> {
let mut builder = SecondTableInABuilder::new(_fbb); let mut builder = SecondTableInABuilder::new(_fbb);
if let Some(x) = args.refer_to_c { builder.add_refer_to_c(x); } if let Some(x) = args.refer_to_c { builder.add_refer_to_c(x); }
builder.finish() builder.finish()
@@ -47,7 +40,7 @@ impl<'a> SecondTableInA<'a> {
pub fn unpack(&self) -> SecondTableInAT { pub fn unpack(&self) -> SecondTableInAT {
let refer_to_c = self.refer_to_c().map(|x| { let refer_to_c = self.refer_to_c().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
SecondTableInAT { SecondTableInAT {
refer_to_c, refer_to_c,
@@ -59,24 +52,23 @@ impl<'a> SecondTableInA<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, None)}
} }
} }
impl flatbuffers::Verifiable for SecondTableInA<'_> { impl ::flatbuffers::Verifiable for SecondTableInA<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC>>("refer_to_c", Self::VT_REFER_TO_C, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::namespace_c::TableInC>>("refer_to_c", Self::VT_REFER_TO_C, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct SecondTableInAArgs<'a> { pub struct SecondTableInAArgs<'a> {
pub refer_to_c: Option<flatbuffers::WIPOffset<super::namespace_c::TableInC<'a>>>, pub refer_to_c: Option<::flatbuffers::WIPOffset<super::namespace_c::TableInC<'a>>>,
} }
impl<'a> Default for SecondTableInAArgs<'a> { impl<'a> Default for SecondTableInAArgs<'a> {
#[inline] #[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for SecondTableInAArgs<'a> {
} }
} }
pub struct SecondTableInABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct SecondTableInABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_refer_to_c(&mut self, refer_to_c: flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) { pub fn add_refer_to_c(&mut self, refer_to_c: ::flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SecondTableInABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> SecondTableInABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
SecondTableInABuilder { SecondTableInABuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<SecondTableInA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<SecondTableInA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for SecondTableInA<'_> { impl ::core::fmt::Debug for SecondTableInA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("SecondTableInA"); let mut ds = f.debug_struct("SecondTableInA");
ds.field("refer_to_c", &self.refer_to_c()); ds.field("refer_to_c", &self.refer_to_c());
ds.finish() ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for SecondTableInA<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct SecondTableInAT { pub struct SecondTableInAT {
pub refer_to_c: Option<Box<super::namespace_c::TableInCT>>, pub refer_to_c: Option<alloc::boxed::Box<super::namespace_c::TableInCT>>,
} }
impl Default for SecondTableInAT { impl Default for SecondTableInAT {
fn default() -> Self { fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for SecondTableInAT {
} }
} }
impl SecondTableInAT { impl SecondTableInAT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<SecondTableInA<'b>> { ) -> ::flatbuffers::WIPOffset<SecondTableInA<'b>> {
let refer_to_c = self.refer_to_c.as_ref().map(|x|{ let refer_to_c = self.refer_to_c.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,49 +1,42 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableInFirstNSOffset {} pub enum TableInFirstNSOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableInFirstNS<'a> { pub struct TableInFirstNS<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableInFirstNS<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableInFirstNS<'a> {
type Inner = TableInFirstNS<'a>; type Inner = TableInFirstNS<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableInFirstNS<'a> { impl<'a> TableInFirstNS<'a> {
pub const VT_FOO_TABLE: flatbuffers::VOffsetT = 4; pub const VT_FOO_TABLE: ::flatbuffers::VOffsetT = 4;
pub const VT_FOO_ENUM: flatbuffers::VOffsetT = 6; pub const VT_FOO_ENUM: ::flatbuffers::VOffsetT = 6;
pub const VT_FOO_UNION_TYPE: flatbuffers::VOffsetT = 8; pub const VT_FOO_UNION_TYPE: ::flatbuffers::VOffsetT = 8;
pub const VT_FOO_UNION: flatbuffers::VOffsetT = 10; pub const VT_FOO_UNION: ::flatbuffers::VOffsetT = 10;
pub const VT_FOO_STRUCT: flatbuffers::VOffsetT = 12; pub const VT_FOO_STRUCT: ::flatbuffers::VOffsetT = 12;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"NamespaceA.TableInFirstNS" "NamespaceA.TableInFirstNS"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableInFirstNS { _tab: table } TableInFirstNS { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableInFirstNSArgs<'args> args: &'args TableInFirstNSArgs<'args>
) -> flatbuffers::WIPOffset<TableInFirstNS<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableInFirstNS<'bldr>> {
let mut builder = TableInFirstNSBuilder::new(_fbb); let mut builder = TableInFirstNSBuilder::new(_fbb);
if let Some(x) = args.foo_struct { builder.add_foo_struct(x); } if let Some(x) = args.foo_struct { builder.add_foo_struct(x); }
if let Some(x) = args.foo_union { builder.add_foo_union(x); } if let Some(x) = args.foo_union { builder.add_foo_union(x); }
@@ -55,12 +48,12 @@ impl<'a> TableInFirstNS<'a> {
pub fn unpack(&self) -> TableInFirstNST { pub fn unpack(&self) -> TableInFirstNST {
let foo_table = self.foo_table().map(|x| { let foo_table = self.foo_table().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
let foo_enum = self.foo_enum(); let foo_enum = self.foo_enum();
let foo_union = match self.foo_union_type() { let foo_union = match self.foo_union_type() {
namespace_b::UnionInNestedNS::NONE => namespace_b::UnionInNestedNST::NONE, namespace_b::UnionInNestedNS::NONE => namespace_b::UnionInNestedNST::NONE,
namespace_b::UnionInNestedNS::TableInNestedNS => namespace_b::UnionInNestedNST::TableInNestedNS(Box::new( namespace_b::UnionInNestedNS::TableInNestedNS => namespace_b::UnionInNestedNST::TableInNestedNS(alloc::boxed::Box::new(
self.foo_union_as_table_in_nested_ns() self.foo_union_as_table_in_nested_ns()
.expect("Invalid union table, expected `namespace_b::UnionInNestedNS::TableInNestedNS`.") .expect("Invalid union table, expected `namespace_b::UnionInNestedNS::TableInNestedNS`.")
.unpack() .unpack()
@@ -83,7 +76,7 @@ impl<'a> TableInFirstNS<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, None)}
} }
#[inline] #[inline]
pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS { pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS {
@@ -100,11 +93,11 @@ impl<'a> TableInFirstNS<'a> {
unsafe { self._tab.get::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, Some(namespace_b::UnionInNestedNS::NONE)).unwrap()} unsafe { self._tab.get::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, Some(namespace_b::UnionInNestedNS::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn foo_union(&self) -> Option<flatbuffers::Table<'a>> { pub fn foo_union(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(TableInFirstNS::VT_FOO_UNION, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(TableInFirstNS::VT_FOO_UNION, None)}
} }
#[inline] #[inline]
pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> { pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> {
@@ -130,18 +123,17 @@ impl<'a> TableInFirstNS<'a> {
} }
impl flatbuffers::Verifiable for TableInFirstNS<'_> { impl ::flatbuffers::Verifiable for TableInFirstNS<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>("foo_table", Self::VT_FOO_TABLE, false)? .visit_field::<::flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>("foo_table", Self::VT_FOO_TABLE, false)?
.visit_field::<namespace_b::EnumInNestedNS>("foo_enum", Self::VT_FOO_ENUM, false)? .visit_field::<namespace_b::EnumInNestedNS>("foo_enum", Self::VT_FOO_ENUM, false)?
.visit_union::<namespace_b::UnionInNestedNS, _>("foo_union_type", Self::VT_FOO_UNION_TYPE, "foo_union", Self::VT_FOO_UNION, false, |key, v, pos| { .visit_union::<namespace_b::UnionInNestedNS, _>("foo_union_type", Self::VT_FOO_UNION_TYPE, "foo_union", Self::VT_FOO_UNION, false, |key, v, pos| {
match key { match key {
namespace_b::UnionInNestedNS::TableInNestedNS => v.verify_union_variant::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>("namespace_b::UnionInNestedNS::TableInNestedNS", pos), namespace_b::UnionInNestedNS::TableInNestedNS => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>("namespace_b::UnionInNestedNS::TableInNestedNS", pos),
_ => Ok(()), _ => Ok(()),
} }
})? })?
@@ -151,10 +143,10 @@ impl flatbuffers::Verifiable for TableInFirstNS<'_> {
} }
} }
pub struct TableInFirstNSArgs<'a> { pub struct TableInFirstNSArgs<'a> {
pub foo_table: Option<flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a>>>, pub foo_table: Option<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a>>>,
pub foo_enum: namespace_b::EnumInNestedNS, pub foo_enum: namespace_b::EnumInNestedNS,
pub foo_union_type: namespace_b::UnionInNestedNS, pub foo_union_type: namespace_b::UnionInNestedNS,
pub foo_union: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>, pub foo_union: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
pub foo_struct: Option<&'a namespace_b::StructInNestedNS>, pub foo_struct: Option<&'a namespace_b::StructInNestedNS>,
} }
impl<'a> Default for TableInFirstNSArgs<'a> { impl<'a> Default for TableInFirstNSArgs<'a> {
@@ -170,14 +162,14 @@ impl<'a> Default for TableInFirstNSArgs<'a> {
} }
} }
pub struct TableInFirstNSBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableInFirstNSBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_foo_table(&mut self, foo_table: flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) { pub fn add_foo_table(&mut self, foo_table: ::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table);
} }
#[inline] #[inline]
pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) { pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) {
@@ -188,15 +180,15 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A
self.fbb_.push_slot::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, foo_union_type, namespace_b::UnionInNestedNS::NONE); self.fbb_.push_slot::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, foo_union_type, namespace_b::UnionInNestedNS::NONE);
} }
#[inline] #[inline]
pub fn add_foo_union(&mut self, foo_union: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) { pub fn add_foo_union(&mut self, foo_union: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TableInFirstNS::VT_FOO_UNION, foo_union); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TableInFirstNS::VT_FOO_UNION, foo_union);
} }
#[inline] #[inline]
pub fn add_foo_struct(&mut self, foo_struct: &namespace_b::StructInNestedNS) { pub fn add_foo_struct(&mut self, foo_struct: &namespace_b::StructInNestedNS) {
self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct); self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableInFirstNSBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInFirstNSBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableInFirstNSBuilder { TableInFirstNSBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -204,14 +196,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableInFirstNS<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInFirstNS<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableInFirstNS<'_> { impl ::core::fmt::Debug for TableInFirstNS<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableInFirstNS"); let mut ds = f.debug_struct("TableInFirstNS");
ds.field("foo_table", &self.foo_table()); ds.field("foo_table", &self.foo_table());
ds.field("foo_enum", &self.foo_enum()); ds.field("foo_enum", &self.foo_enum());
@@ -236,7 +228,7 @@ impl core::fmt::Debug for TableInFirstNS<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableInFirstNST { pub struct TableInFirstNST {
pub foo_table: Option<Box<namespace_b::TableInNestedNST>>, pub foo_table: Option<alloc::boxed::Box<namespace_b::TableInNestedNST>>,
pub foo_enum: namespace_b::EnumInNestedNS, pub foo_enum: namespace_b::EnumInNestedNS,
pub foo_union: namespace_b::UnionInNestedNST, pub foo_union: namespace_b::UnionInNestedNST,
pub foo_struct: Option<namespace_b::StructInNestedNST>, pub foo_struct: Option<namespace_b::StructInNestedNST>,
@@ -252,10 +244,10 @@ impl Default for TableInFirstNST {
} }
} }
impl TableInFirstNST { impl TableInFirstNST {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableInFirstNS<'b>> { ) -> ::flatbuffers::WIPOffset<TableInFirstNS<'b>> {
let foo_table = self.foo_table.as_ref().map(|x|{ let foo_table = self.foo_table.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,46 +1,39 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum TableInCOffset {} pub enum TableInCOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct TableInC<'a> { pub struct TableInC<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for TableInC<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableInC<'a> {
type Inner = TableInC<'a>; type Inner = TableInC<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> TableInC<'a> { impl<'a> TableInC<'a> {
pub const VT_REFER_TO_A1: flatbuffers::VOffsetT = 4; pub const VT_REFER_TO_A1: ::flatbuffers::VOffsetT = 4;
pub const VT_REFER_TO_A2: flatbuffers::VOffsetT = 6; pub const VT_REFER_TO_A2: ::flatbuffers::VOffsetT = 6;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"NamespaceC.TableInC" "NamespaceC.TableInC"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableInC { _tab: table } TableInC { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableInCArgs<'args> args: &'args TableInCArgs<'args>
) -> flatbuffers::WIPOffset<TableInC<'bldr>> { ) -> ::flatbuffers::WIPOffset<TableInC<'bldr>> {
let mut builder = TableInCBuilder::new(_fbb); let mut builder = TableInCBuilder::new(_fbb);
if let Some(x) = args.refer_to_a2 { builder.add_refer_to_a2(x); } if let Some(x) = args.refer_to_a2 { builder.add_refer_to_a2(x); }
if let Some(x) = args.refer_to_a1 { builder.add_refer_to_a1(x); } if let Some(x) = args.refer_to_a1 { builder.add_refer_to_a1(x); }
@@ -49,10 +42,10 @@ impl<'a> TableInC<'a> {
pub fn unpack(&self) -> TableInCT { pub fn unpack(&self) -> TableInCT {
let refer_to_a1 = self.refer_to_a1().map(|x| { let refer_to_a1 = self.refer_to_a1().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
let refer_to_a2 = self.refer_to_a2().map(|x| { let refer_to_a2 = self.refer_to_a2().map(|x| {
Box::new(x.unpack()) alloc::boxed::Box::new(x.unpack())
}); });
TableInCT { TableInCT {
refer_to_a1, refer_to_a1,
@@ -65,33 +58,32 @@ impl<'a> TableInC<'a> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, None)}
} }
#[inline] #[inline]
pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> { pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, None)}
} }
} }
impl flatbuffers::Verifiable for TableInC<'_> { impl ::flatbuffers::Verifiable for TableInC<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>("refer_to_a1", Self::VT_REFER_TO_A1, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>("refer_to_a1", Self::VT_REFER_TO_A1, false)?
.visit_field::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA>>("refer_to_a2", Self::VT_REFER_TO_A2, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA>>("refer_to_a2", Self::VT_REFER_TO_A2, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
} }
pub struct TableInCArgs<'a> { pub struct TableInCArgs<'a> {
pub refer_to_a1: Option<flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a>>>, pub refer_to_a1: Option<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a>>>,
pub refer_to_a2: Option<flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a>>>, pub refer_to_a2: Option<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a>>>,
} }
impl<'a> Default for TableInCArgs<'a> { impl<'a> Default for TableInCArgs<'a> {
#[inline] #[inline]
@@ -103,21 +95,21 @@ impl<'a> Default for TableInCArgs<'a> {
} }
} }
pub struct TableInCBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct TableInCBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_refer_to_a1(&mut self, refer_to_a1: flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) { pub fn add_refer_to_a1(&mut self, refer_to_a1: ::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1);
} }
#[inline] #[inline]
pub fn add_refer_to_a2(&mut self, refer_to_a2: flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) { pub fn add_refer_to_a2(&mut self, refer_to_a2: ::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableInCBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInCBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
TableInCBuilder { TableInCBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -125,14 +117,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<TableInC<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInC<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for TableInC<'_> { impl ::core::fmt::Debug for TableInC<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableInC"); let mut ds = f.debug_struct("TableInC");
ds.field("refer_to_a1", &self.refer_to_a1()); ds.field("refer_to_a1", &self.refer_to_a1());
ds.field("refer_to_a2", &self.refer_to_a2()); ds.field("refer_to_a2", &self.refer_to_a2());
@@ -142,8 +134,8 @@ impl core::fmt::Debug for TableInC<'_> {
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableInCT { pub struct TableInCT {
pub refer_to_a1: Option<Box<super::namespace_a::TableInFirstNST>>, pub refer_to_a1: Option<alloc::boxed::Box<super::namespace_a::TableInFirstNST>>,
pub refer_to_a2: Option<Box<super::namespace_a::SecondTableInAT>>, pub refer_to_a2: Option<alloc::boxed::Box<super::namespace_a::SecondTableInAT>>,
} }
impl Default for TableInCT { impl Default for TableInCT {
fn default() -> Self { fn default() -> Self {
@@ -154,10 +146,10 @@ impl Default for TableInCT {
} }
} }
impl TableInCT { impl TableInCT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableInC<'b>> { ) -> ::flatbuffers::WIPOffset<TableInC<'b>> {
let refer_to_a1 = self.refer_to_a1.as_ref().map(|x|{ let refer_to_a1 = self.refer_to_a1.as_ref().map(|x|{
x.pack(_fbb) x.pack(_fbb)
}); });

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0; pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0;
@@ -47,8 +40,8 @@ impl OptionalByte {
} }
} }
} }
impl core::fmt::Debug for OptionalByte { impl ::core::fmt::Debug for OptionalByte {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for OptionalByte {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for OptionalByte { impl<'a> ::flatbuffers::Follow<'a> for OptionalByte {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for OptionalByte { impl ::flatbuffers::Push for OptionalByte {
type Output = OptionalByte; type Output = OptionalByte;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for OptionalByte { impl ::flatbuffers::EndianScalar for OptionalByte {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for OptionalByte {
} }
} }
impl<'a> flatbuffers::Verifiable for OptionalByte { impl<'a> ::flatbuffers::Verifiable for OptionalByte {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for OptionalByte {} impl ::flatbuffers::SimpleToVerifyInSlice for OptionalByte {}

View File

@@ -1,80 +1,73 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum ScalarStuffOffset {} pub enum ScalarStuffOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct ScalarStuff<'a> { pub struct ScalarStuff<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for ScalarStuff<'a> { impl<'a> ::flatbuffers::Follow<'a> for ScalarStuff<'a> {
type Inner = ScalarStuff<'a>; type Inner = ScalarStuff<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> ScalarStuff<'a> { impl<'a> ScalarStuff<'a> {
pub const VT_JUST_I8: flatbuffers::VOffsetT = 4; pub const VT_JUST_I8: ::flatbuffers::VOffsetT = 4;
pub const VT_MAYBE_I8: flatbuffers::VOffsetT = 6; pub const VT_MAYBE_I8: ::flatbuffers::VOffsetT = 6;
pub const VT_DEFAULT_I8: flatbuffers::VOffsetT = 8; pub const VT_DEFAULT_I8: ::flatbuffers::VOffsetT = 8;
pub const VT_JUST_U8: flatbuffers::VOffsetT = 10; pub const VT_JUST_U8: ::flatbuffers::VOffsetT = 10;
pub const VT_MAYBE_U8: flatbuffers::VOffsetT = 12; pub const VT_MAYBE_U8: ::flatbuffers::VOffsetT = 12;
pub const VT_DEFAULT_U8: flatbuffers::VOffsetT = 14; pub const VT_DEFAULT_U8: ::flatbuffers::VOffsetT = 14;
pub const VT_JUST_I16: flatbuffers::VOffsetT = 16; pub const VT_JUST_I16: ::flatbuffers::VOffsetT = 16;
pub const VT_MAYBE_I16: flatbuffers::VOffsetT = 18; pub const VT_MAYBE_I16: ::flatbuffers::VOffsetT = 18;
pub const VT_DEFAULT_I16: flatbuffers::VOffsetT = 20; pub const VT_DEFAULT_I16: ::flatbuffers::VOffsetT = 20;
pub const VT_JUST_U16: flatbuffers::VOffsetT = 22; pub const VT_JUST_U16: ::flatbuffers::VOffsetT = 22;
pub const VT_MAYBE_U16: flatbuffers::VOffsetT = 24; pub const VT_MAYBE_U16: ::flatbuffers::VOffsetT = 24;
pub const VT_DEFAULT_U16: flatbuffers::VOffsetT = 26; pub const VT_DEFAULT_U16: ::flatbuffers::VOffsetT = 26;
pub const VT_JUST_I32: flatbuffers::VOffsetT = 28; pub const VT_JUST_I32: ::flatbuffers::VOffsetT = 28;
pub const VT_MAYBE_I32: flatbuffers::VOffsetT = 30; pub const VT_MAYBE_I32: ::flatbuffers::VOffsetT = 30;
pub const VT_DEFAULT_I32: flatbuffers::VOffsetT = 32; pub const VT_DEFAULT_I32: ::flatbuffers::VOffsetT = 32;
pub const VT_JUST_U32: flatbuffers::VOffsetT = 34; pub const VT_JUST_U32: ::flatbuffers::VOffsetT = 34;
pub const VT_MAYBE_U32: flatbuffers::VOffsetT = 36; pub const VT_MAYBE_U32: ::flatbuffers::VOffsetT = 36;
pub const VT_DEFAULT_U32: flatbuffers::VOffsetT = 38; pub const VT_DEFAULT_U32: ::flatbuffers::VOffsetT = 38;
pub const VT_JUST_I64: flatbuffers::VOffsetT = 40; pub const VT_JUST_I64: ::flatbuffers::VOffsetT = 40;
pub const VT_MAYBE_I64: flatbuffers::VOffsetT = 42; pub const VT_MAYBE_I64: ::flatbuffers::VOffsetT = 42;
pub const VT_DEFAULT_I64: flatbuffers::VOffsetT = 44; pub const VT_DEFAULT_I64: ::flatbuffers::VOffsetT = 44;
pub const VT_JUST_U64: flatbuffers::VOffsetT = 46; pub const VT_JUST_U64: ::flatbuffers::VOffsetT = 46;
pub const VT_MAYBE_U64: flatbuffers::VOffsetT = 48; pub const VT_MAYBE_U64: ::flatbuffers::VOffsetT = 48;
pub const VT_DEFAULT_U64: flatbuffers::VOffsetT = 50; pub const VT_DEFAULT_U64: ::flatbuffers::VOffsetT = 50;
pub const VT_JUST_F32: flatbuffers::VOffsetT = 52; pub const VT_JUST_F32: ::flatbuffers::VOffsetT = 52;
pub const VT_MAYBE_F32: flatbuffers::VOffsetT = 54; pub const VT_MAYBE_F32: ::flatbuffers::VOffsetT = 54;
pub const VT_DEFAULT_F32: flatbuffers::VOffsetT = 56; pub const VT_DEFAULT_F32: ::flatbuffers::VOffsetT = 56;
pub const VT_JUST_F64: flatbuffers::VOffsetT = 58; pub const VT_JUST_F64: ::flatbuffers::VOffsetT = 58;
pub const VT_MAYBE_F64: flatbuffers::VOffsetT = 60; pub const VT_MAYBE_F64: ::flatbuffers::VOffsetT = 60;
pub const VT_DEFAULT_F64: flatbuffers::VOffsetT = 62; pub const VT_DEFAULT_F64: ::flatbuffers::VOffsetT = 62;
pub const VT_JUST_BOOL: flatbuffers::VOffsetT = 64; pub const VT_JUST_BOOL: ::flatbuffers::VOffsetT = 64;
pub const VT_MAYBE_BOOL: flatbuffers::VOffsetT = 66; pub const VT_MAYBE_BOOL: ::flatbuffers::VOffsetT = 66;
pub const VT_DEFAULT_BOOL: flatbuffers::VOffsetT = 68; pub const VT_DEFAULT_BOOL: ::flatbuffers::VOffsetT = 68;
pub const VT_JUST_ENUM: flatbuffers::VOffsetT = 70; pub const VT_JUST_ENUM: ::flatbuffers::VOffsetT = 70;
pub const VT_MAYBE_ENUM: flatbuffers::VOffsetT = 72; pub const VT_MAYBE_ENUM: ::flatbuffers::VOffsetT = 72;
pub const VT_DEFAULT_ENUM: flatbuffers::VOffsetT = 74; pub const VT_DEFAULT_ENUM: ::flatbuffers::VOffsetT = 74;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"optional_scalars.ScalarStuff" "optional_scalars.ScalarStuff"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ScalarStuff { _tab: table } ScalarStuff { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ScalarStuffArgs args: &'args ScalarStuffArgs
) -> flatbuffers::WIPOffset<ScalarStuff<'bldr>> { ) -> ::flatbuffers::WIPOffset<ScalarStuff<'bldr>> {
let mut builder = ScalarStuffBuilder::new(_fbb); let mut builder = ScalarStuffBuilder::new(_fbb);
builder.add_default_f64(args.default_f64); builder.add_default_f64(args.default_f64);
if let Some(x) = args.maybe_f64 { builder.add_maybe_f64(x); } if let Some(x) = args.maybe_f64 { builder.add_maybe_f64(x); }
@@ -446,12 +439,11 @@ impl<'a> ScalarStuff<'a> {
} }
} }
impl flatbuffers::Verifiable for ScalarStuff<'_> { impl ::flatbuffers::Verifiable for ScalarStuff<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i8>("just_i8", Self::VT_JUST_I8, false)? .visit_field::<i8>("just_i8", Self::VT_JUST_I8, false)?
.visit_field::<i8>("maybe_i8", Self::VT_MAYBE_I8, false)? .visit_field::<i8>("maybe_i8", Self::VT_MAYBE_I8, false)?
@@ -575,11 +567,11 @@ impl<'a> Default for ScalarStuffArgs {
} }
} }
pub struct ScalarStuffBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct ScalarStuffBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_just_i8(&mut self, just_i8: i8) { pub fn add_just_i8(&mut self, just_i8: i8) {
self.fbb_.push_slot::<i8>(ScalarStuff::VT_JUST_I8, just_i8, 0); self.fbb_.push_slot::<i8>(ScalarStuff::VT_JUST_I8, just_i8, 0);
@@ -725,7 +717,7 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, default_enum, OptionalByte::One); self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, default_enum, OptionalByte::One);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ScalarStuffBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ScalarStuffBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
ScalarStuffBuilder { ScalarStuffBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -733,14 +725,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<ScalarStuff<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<ScalarStuff<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for ScalarStuff<'_> { impl ::core::fmt::Debug for ScalarStuff<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("ScalarStuff"); let mut ds = f.debug_struct("ScalarStuff");
ds.field("just_i8", &self.just_i8()); ds.field("just_i8", &self.just_i8());
ds.field("maybe_i8", &self.maybe_i8()); ds.field("maybe_i8", &self.maybe_i8());
@@ -864,10 +856,10 @@ impl Default for ScalarStuffT {
} }
} }
impl ScalarStuffT { impl ScalarStuffT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<ScalarStuff<'b>> { ) -> ::flatbuffers::WIPOffset<ScalarStuff<'b>> {
let just_i8 = self.just_i8; let just_i8 = self.just_i8;
let maybe_i8 = self.maybe_i8; let maybe_i8 = self.maybe_i8;
let default_i8 = self.default_i8; let default_i8 = self.default_i8;
@@ -951,8 +943,8 @@ impl ScalarStuffT {
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`. /// `root_as_scalar_stuff_unchecked`.
pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::InvalidFlatbuffer> { pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<ScalarStuff>(buf) ::flatbuffers::root::<ScalarStuff>(buf)
} }
#[inline] #[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
@@ -961,8 +953,8 @@ pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_scalar_stuff_unchecked`. /// `size_prefixed_root_as_scalar_stuff_unchecked`.
pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<ScalarStuff>(buf) ::flatbuffers::size_prefixed_root::<ScalarStuff>(buf)
} }
#[inline] #[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
@@ -972,10 +964,10 @@ pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>,
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`. /// `root_as_scalar_stuff_unchecked`.
pub fn root_as_scalar_stuff_with_opts<'b, 'o>( pub fn root_as_scalar_stuff_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ScalarStuff<'b>, flatbuffers::InvalidFlatbuffer> { ) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<ScalarStuff<'b>>(opts, buf) ::flatbuffers::root_with_opts::<ScalarStuff<'b>>(opts, buf)
} }
#[inline] #[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
@@ -985,47 +977,47 @@ pub fn root_as_scalar_stuff_with_opts<'b, 'o>(
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`. /// `root_as_scalar_stuff_unchecked`.
pub fn size_prefixed_root_as_scalar_stuff_with_opts<'b, 'o>( pub fn size_prefixed_root_as_scalar_stuff_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ScalarStuff<'b>, flatbuffers::InvalidFlatbuffer> { ) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<ScalarStuff<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<ScalarStuff<'b>>(opts, buf)
} }
#[inline] #[inline]
/// Assumes, without verification, that a buffer of bytes contains a ScalarStuff and returns it. /// Assumes, without verification, that a buffer of bytes contains a ScalarStuff and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `ScalarStuff`. /// Callers must trust the given bytes do indeed contain a valid `ScalarStuff`.
pub unsafe fn root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> { pub unsafe fn root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> {
unsafe { flatbuffers::root_unchecked::<ScalarStuff>(buf) } unsafe { ::flatbuffers::root_unchecked::<ScalarStuff>(buf) }
} }
#[inline] #[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ScalarStuff and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed ScalarStuff and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ScalarStuff`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `ScalarStuff`.
pub unsafe fn size_prefixed_root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> { pub unsafe fn size_prefixed_root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> {
unsafe { flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) }
} }
pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL"; pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL";
#[inline] #[inline]
pub fn scalar_stuff_buffer_has_identifier(buf: &[u8]) -> bool { pub fn scalar_stuff_buffer_has_identifier(buf: &[u8]) -> bool {
flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, false) ::flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, false)
} }
#[inline] #[inline]
pub fn scalar_stuff_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool { pub fn scalar_stuff_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, true) ::flatbuffers::buffer_has_identifier(buf, SCALAR_STUFF_IDENTIFIER, true)
} }
pub const SCALAR_STUFF_EXTENSION: &str = "mon"; pub const SCALAR_STUFF_EXTENSION: &str = "mon";
#[inline] #[inline]
pub fn finish_scalar_stuff_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( pub fn finish_scalar_stuff_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<ScalarStuff<'a>>) { root: ::flatbuffers::WIPOffset<ScalarStuff<'a>>) {
fbb.finish(root, Some(SCALAR_STUFF_IDENTIFIER)); fbb.finish(root, Some(SCALAR_STUFF_IDENTIFIER));
} }
#[inline] #[inline]
pub fn finish_size_prefixed_scalar_stuff_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<ScalarStuff<'a>>) { pub fn finish_size_prefixed_scalar_stuff_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<ScalarStuff<'a>>) {
fbb.finish_size_prefixed(root, Some(SCALAR_STUFF_IDENTIFIER)); fbb.finish_size_prefixed(root, Some(SCALAR_STUFF_IDENTIFIER));
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_AB: i8 = 0; pub const ENUM_MIN_AB: i8 = 0;
@@ -43,8 +36,8 @@ impl AB {
} }
} }
} }
impl core::fmt::Debug for AB { impl ::core::fmt::Debug for AB {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -52,24 +45,24 @@ impl core::fmt::Debug for AB {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for AB { impl<'a> ::flatbuffers::Follow<'a> for AB {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for AB { impl ::flatbuffers::Push for AB {
type Output = AB; type Output = AB;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for AB { impl ::flatbuffers::EndianScalar for AB {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
@@ -83,14 +76,13 @@ impl flatbuffers::EndianScalar for AB {
} }
} }
impl<'a> flatbuffers::Verifiable for AB { impl<'a> ::flatbuffers::Verifiable for AB {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
i8::run_verifier(v, pos) i8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for AB {} impl ::flatbuffers::SimpleToVerifyInSlice for AB {}

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub(crate) enum AnnotationsOffset {} pub(crate) enum AnnotationsOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub(crate) struct Annotations<'a> { pub(crate) struct Annotations<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Annotations<'a> { impl<'a> ::flatbuffers::Follow<'a> for Annotations<'a> {
type Inner = Annotations<'a>; type Inner = Annotations<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Annotations<'a> { impl<'a> Annotations<'a> {
pub const VT_VALUE: flatbuffers::VOffsetT = 4; pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"Annotations" "Annotations"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Annotations { _tab: table } Annotations { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args AnnotationsArgs args: &'args AnnotationsArgs
) -> flatbuffers::WIPOffset<Annotations<'bldr>> { ) -> ::flatbuffers::WIPOffset<Annotations<'bldr>> {
let mut builder = AnnotationsBuilder::new(_fbb); let mut builder = AnnotationsBuilder::new(_fbb);
builder.add_value(args.value); builder.add_value(args.value);
builder.finish() builder.finish()
@@ -61,12 +54,11 @@ impl<'a> Annotations<'a> {
} }
} }
impl flatbuffers::Verifiable for Annotations<'_> { impl ::flatbuffers::Verifiable for Annotations<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)? .visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish(); .finish();
@@ -85,17 +77,17 @@ impl<'a> Default for AnnotationsArgs {
} }
} }
pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_value(&mut self, value: i32) { pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0); self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
AnnotationsBuilder { AnnotationsBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Annotations<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Annotations<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Annotations<'_> { impl ::core::fmt::Debug for Annotations<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Annotations"); let mut ds = f.debug_struct("Annotations");
ds.field("value", &self.value()); ds.field("value", &self.value());
ds.finish() ds.finish()
@@ -129,10 +121,10 @@ impl Default for AnnotationsT {
} }
} }
impl AnnotationsT { impl AnnotationsT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Annotations<'b>> { ) -> ::flatbuffers::WIPOffset<Annotations<'b>> {
let value = self.value; let value = self.value;
Annotations::create(_fbb, &AnnotationsArgs{ Annotations::create(_fbb, &AnnotationsArgs{
value, value,

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[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; pub const ENUM_MIN_ANY: u8 = 0;
@@ -47,8 +40,8 @@ impl Any {
} }
} }
} }
impl core::fmt::Debug for Any { impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -56,24 +49,24 @@ impl core::fmt::Debug for Any {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for Any { impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for Any { impl ::flatbuffers::Push for Any {
type Output = Any; type Output = Any;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for Any { impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -87,17 +80,16 @@ impl flatbuffers::EndianScalar for Any {
} }
} }
impl<'a> flatbuffers::Verifiable for Any { impl<'a> ::flatbuffers::Verifiable for Any {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Any {} impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub(crate) struct AnyUnionTableOffset {} pub(crate) struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -105,8 +97,8 @@ pub(crate) struct AnyUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub(crate) enum AnyT { pub(crate) enum AnyT {
NONE, NONE,
Game(Box<GameT>), Game(alloc::boxed::Box<GameT>),
Annotations(Box<AnnotationsT>), Annotations(alloc::boxed::Box<AnnotationsT>),
} }
impl Default for AnyT { impl Default for AnyT {
fn default() -> Self { fn default() -> Self {
@@ -121,7 +113,7 @@ impl AnyT {
Self::Annotations(_) => Any::Annotations, Self::Annotations(_) => Any::Annotations,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::Game(v) => Some(v.pack(fbb).as_union_value()), Self::Game(v) => Some(v.pack(fbb).as_union_value()),
@@ -129,9 +121,9 @@ impl AnyT {
} }
} }
/// If the union variant matches, return the owned GameT, setting the union to NONE. /// If the union variant matches, return the owned GameT, setting the union to NONE.
pub fn take_game(&mut self) -> Option<Box<GameT>> { pub fn take_game(&mut self) -> Option<alloc::boxed::Box<GameT>> {
if let Self::Game(_) = self { if let Self::Game(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Game(w) = v { if let Self::Game(w) = v {
Some(w) Some(w)
} else { } else {
@@ -150,9 +142,9 @@ impl AnyT {
if let Self::Game(v) = self { Some(v.as_mut()) } else { None } if let Self::Game(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned AnnotationsT, setting the union to NONE. /// If the union variant matches, return the owned AnnotationsT, setting the union to NONE.
pub fn take_annotations(&mut self) -> Option<Box<AnnotationsT>> { pub fn take_annotations(&mut self) -> Option<alloc::boxed::Box<AnnotationsT>> {
if let Self::Annotations(_) = self { if let Self::Annotations(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::Annotations(w) = v { if let Self::Annotations(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub(crate) enum GameOffset {} pub(crate) enum GameOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub(crate) struct Game<'a> { pub(crate) struct Game<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for Game<'a> { impl<'a> ::flatbuffers::Follow<'a> for Game<'a> {
type Inner = Game<'a>; type Inner = Game<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> Game<'a> { impl<'a> Game<'a> {
pub const VT_VALUE: flatbuffers::VOffsetT = 4; pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"Game" "Game"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Game { _tab: table } Game { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args GameArgs args: &'args GameArgs
) -> flatbuffers::WIPOffset<Game<'bldr>> { ) -> ::flatbuffers::WIPOffset<Game<'bldr>> {
let mut builder = GameBuilder::new(_fbb); let mut builder = GameBuilder::new(_fbb);
builder.add_value(args.value); builder.add_value(args.value);
builder.finish() builder.finish()
@@ -61,12 +54,11 @@ impl<'a> Game<'a> {
} }
} }
impl flatbuffers::Verifiable for Game<'_> { impl ::flatbuffers::Verifiable for Game<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)? .visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish(); .finish();
@@ -85,17 +77,17 @@ impl<'a> Default for GameArgs {
} }
} }
pub(crate) struct GameBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub(crate) struct GameBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_value(&mut self, value: i32) { pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0); self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
GameBuilder { GameBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Game<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Game<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for Game<'_> { impl ::core::fmt::Debug for Game<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Game"); let mut ds = f.debug_struct("Game");
ds.field("value", &self.value()); ds.field("value", &self.value());
ds.finish() ds.finish()
@@ -129,10 +121,10 @@ impl Default for GameT {
} }
} }
impl GameT { impl GameT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Game<'b>> { ) -> ::flatbuffers::WIPOffset<Game<'b>> {
let value = self.value; let value = self.value;
Game::create(_fbb, &GameArgs{ Game::create(_fbb, &GameArgs{
value, value,

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct Object, aligned to 4 // struct Object, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,48 +11,47 @@ impl Default for Object {
Self([0; 4]) Self([0; 4])
} }
} }
impl core::fmt::Debug for Object { impl ::core::fmt::Debug for Object {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Object") f.debug_struct("Object")
.field("value", &self.value()) .field("value", &self.value())
.finish() .finish()
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for Object {} impl ::flatbuffers::SimpleToVerifyInSlice for Object {}
impl<'a> flatbuffers::Follow<'a> for Object { impl<'a> ::flatbuffers::Follow<'a> for Object {
type Inner = &'a Object; type Inner = &'a Object;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Object>::follow(buf, loc) } unsafe { <&'a Object>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a Object { impl<'a> ::flatbuffers::Follow<'a> for &'a Object {
type Inner = &'a Object; type Inner = &'a Object;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Object>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Object>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for Object { impl<'b> ::flatbuffers::Push for Object {
type Output = Object; type Output = Object;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Object as *const u8, <Self as flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Object as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for Object { impl<'a> ::flatbuffers::Verifiable for Object {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -79,30 +71,30 @@ impl<'a> Object {
} }
pub fn value(&self) -> i32 { pub fn value(&self) -> i32 {
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_value(&mut self, x: i32) { pub fn set_value(&mut self, x: i32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,26 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum FieldTableOffset {} pub enum FieldTableOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct FieldTable<'a> { pub struct FieldTable<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for FieldTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for FieldTable<'a> {
type Inner = FieldTable<'a>; type Inner = FieldTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -31,14 +24,14 @@ impl<'a> FieldTable<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
FieldTable { _tab: table } FieldTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args FieldTableArgs _args: &'args FieldTableArgs
) -> flatbuffers::WIPOffset<FieldTable<'bldr>> { ) -> ::flatbuffers::WIPOffset<FieldTable<'bldr>> {
let mut builder = FieldTableBuilder::new(_fbb); let mut builder = FieldTableBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -49,12 +42,11 @@ impl<'a> FieldTable<'a> {
} }
} }
impl flatbuffers::Verifiable for FieldTable<'_> { impl ::flatbuffers::Verifiable for FieldTable<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -70,13 +62,13 @@ impl<'a> Default for FieldTableArgs {
} }
} }
pub struct FieldTableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct FieldTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FieldTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> FieldTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
FieldTableBuilder { FieldTableBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -84,14 +76,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<FieldTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<FieldTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for FieldTable<'_> { impl ::core::fmt::Debug for FieldTable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("FieldTable"); let mut ds = f.debug_struct("FieldTable");
ds.finish() ds.finish()
} }
@@ -107,10 +99,10 @@ impl Default for FieldTableT {
} }
} }
impl FieldTableT { impl FieldTableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<FieldTable<'b>> { ) -> ::flatbuffers::WIPOffset<FieldTable<'b>> {
FieldTable::create(_fbb, &FieldTableArgs{ FieldTable::create(_fbb, &FieldTableArgs{
}) })
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FIELD_UNION: u8 = 0; pub const ENUM_MIN_FIELD_UNION: u8 = 0;
@@ -43,8 +36,8 @@ impl FieldUnion {
} }
} }
} }
impl core::fmt::Debug for FieldUnion { impl ::core::fmt::Debug for FieldUnion {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -52,24 +45,24 @@ impl core::fmt::Debug for FieldUnion {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for FieldUnion { impl<'a> ::flatbuffers::Follow<'a> for FieldUnion {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for FieldUnion { impl ::flatbuffers::Push for FieldUnion {
type Output = FieldUnion; type Output = FieldUnion;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for FieldUnion { impl ::flatbuffers::EndianScalar for FieldUnion {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -83,17 +76,16 @@ impl flatbuffers::EndianScalar for FieldUnion {
} }
} }
impl<'a> flatbuffers::Verifiable for FieldUnion { impl<'a> ::flatbuffers::Verifiable for FieldUnion {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for FieldUnion {} impl ::flatbuffers::SimpleToVerifyInSlice for FieldUnion {}
pub struct FieldUnionUnionTableOffset {} pub struct FieldUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -101,7 +93,7 @@ pub struct FieldUnionUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum FieldUnionT { pub enum FieldUnionT {
NONE, NONE,
F(Box<FieldTableT>), F(alloc::boxed::Box<FieldTableT>),
} }
impl Default for FieldUnionT { impl Default for FieldUnionT {
fn default() -> Self { fn default() -> Self {
@@ -115,16 +107,16 @@ impl FieldUnionT {
Self::F(_) => FieldUnion::f, Self::F(_) => FieldUnion::f,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::F(v) => Some(v.pack(fbb).as_union_value()), Self::F(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned FieldTableT, setting the union to NONE. /// If the union variant matches, return the owned FieldTableT, setting the union to NONE.
pub fn take_f(&mut self) -> Option<Box<FieldTableT>> { pub fn take_f(&mut self) -> Option<alloc::boxed::Box<FieldTableT>> {
if let Self::F(_) = self { if let Self::F(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::F(w) = v { if let Self::F(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_GAME_MESSAGE: u8 = 0; pub const ENUM_MIN_GAME_MESSAGE: u8 = 0;
@@ -51,8 +44,8 @@ impl GameMessage {
} }
} }
} }
impl core::fmt::Debug for GameMessage { impl ::core::fmt::Debug for GameMessage {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
f.write_str(name) f.write_str(name)
} else { } else {
@@ -60,24 +53,24 @@ impl core::fmt::Debug for GameMessage {
} }
} }
} }
impl<'a> flatbuffers::Follow<'a> for GameMessage { impl<'a> ::flatbuffers::Follow<'a> for GameMessage {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b) Self(b)
} }
} }
impl flatbuffers::Push for GameMessage { impl ::flatbuffers::Push for GameMessage {
type Output = GameMessage; type Output = GameMessage;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); } unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
} }
} }
impl flatbuffers::EndianScalar for GameMessage { impl ::flatbuffers::EndianScalar for GameMessage {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
@@ -91,17 +84,16 @@ impl flatbuffers::EndianScalar for GameMessage {
} }
} }
impl<'a> flatbuffers::Verifiable for GameMessage { impl<'a> ::flatbuffers::Verifiable for GameMessage {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos) u8::run_verifier(v, pos)
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for GameMessage {} impl ::flatbuffers::SimpleToVerifyInSlice for GameMessage {}
pub struct GameMessageUnionTableOffset {} pub struct GameMessageUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -109,9 +101,9 @@ pub struct GameMessageUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum GameMessageT { pub enum GameMessageT {
NONE, NONE,
PlayerStatEvent(Box<PlayerStatEventT>), PlayerStatEvent(alloc::boxed::Box<PlayerStatEventT>),
PlayerSpectate(Box<PlayerSpectateT>), PlayerSpectate(alloc::boxed::Box<PlayerSpectateT>),
PlayerInputChange(Box<PlayerInputChangeT>), PlayerInputChange(alloc::boxed::Box<PlayerInputChangeT>),
} }
impl Default for GameMessageT { impl Default for GameMessageT {
fn default() -> Self { fn default() -> Self {
@@ -127,7 +119,7 @@ impl GameMessageT {
Self::PlayerInputChange(_) => GameMessage::PlayerInputChange, Self::PlayerInputChange(_) => GameMessage::PlayerInputChange,
} }
} }
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::PlayerStatEvent(v) => Some(v.pack(fbb).as_union_value()), Self::PlayerStatEvent(v) => Some(v.pack(fbb).as_union_value()),
@@ -136,9 +128,9 @@ impl GameMessageT {
} }
} }
/// If the union variant matches, return the owned PlayerStatEventT, setting the union to NONE. /// If the union variant matches, return the owned PlayerStatEventT, setting the union to NONE.
pub fn take_player_stat_event(&mut self) -> Option<Box<PlayerStatEventT>> { pub fn take_player_stat_event(&mut self) -> Option<alloc::boxed::Box<PlayerStatEventT>> {
if let Self::PlayerStatEvent(_) = self { if let Self::PlayerStatEvent(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::PlayerStatEvent(w) = v { if let Self::PlayerStatEvent(w) = v {
Some(w) Some(w)
} else { } else {
@@ -157,9 +149,9 @@ impl GameMessageT {
if let Self::PlayerStatEvent(v) = self { Some(v.as_mut()) } else { None } if let Self::PlayerStatEvent(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned PlayerSpectateT, setting the union to NONE. /// If the union variant matches, return the owned PlayerSpectateT, setting the union to NONE.
pub fn take_player_spectate(&mut self) -> Option<Box<PlayerSpectateT>> { pub fn take_player_spectate(&mut self) -> Option<alloc::boxed::Box<PlayerSpectateT>> {
if let Self::PlayerSpectate(_) = self { if let Self::PlayerSpectate(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::PlayerSpectate(w) = v { if let Self::PlayerSpectate(w) = v {
Some(w) Some(w)
} else { } else {
@@ -178,9 +170,9 @@ impl GameMessageT {
if let Self::PlayerSpectate(v) = self { Some(v.as_mut()) } else { None } if let Self::PlayerSpectate(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned PlayerInputChangeT, setting the union to NONE. /// If the union variant matches, return the owned PlayerInputChangeT, setting the union to NONE.
pub fn take_player_input_change(&mut self) -> Option<Box<PlayerInputChangeT>> { pub fn take_player_input_change(&mut self) -> Option<alloc::boxed::Box<PlayerInputChangeT>> {
if let Self::PlayerInputChange(_) = self { if let Self::PlayerInputChange(_) = self {
let v = core::mem::replace(self, Self::NONE); let v = ::core::mem::replace(self, Self::NONE);
if let Self::PlayerInputChange(w) = v { if let Self::PlayerInputChange(w) = v {
Some(w) Some(w)
} else { } else {

View File

@@ -1,46 +1,39 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum GameMessageWrapperOffset {} pub enum GameMessageWrapperOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct GameMessageWrapper<'a> { pub struct GameMessageWrapper<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for GameMessageWrapper<'a> { impl<'a> ::flatbuffers::Follow<'a> for GameMessageWrapper<'a> {
type Inner = GameMessageWrapper<'a>; type Inner = GameMessageWrapper<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> GameMessageWrapper<'a> { impl<'a> GameMessageWrapper<'a> {
pub const VT_MESSAGE_TYPE: flatbuffers::VOffsetT = 4; pub const VT_MESSAGE_TYPE: ::flatbuffers::VOffsetT = 4;
pub const VT_MESSAGE: flatbuffers::VOffsetT = 6; pub const VT_MESSAGE: ::flatbuffers::VOffsetT = 6;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"RustNamerTest.GameMessageWrapper" "RustNamerTest.GameMessageWrapper"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
GameMessageWrapper { _tab: table } GameMessageWrapper { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args GameMessageWrapperArgs args: &'args GameMessageWrapperArgs
) -> flatbuffers::WIPOffset<GameMessageWrapper<'bldr>> { ) -> ::flatbuffers::WIPOffset<GameMessageWrapper<'bldr>> {
let mut builder = GameMessageWrapperBuilder::new(_fbb); let mut builder = GameMessageWrapperBuilder::new(_fbb);
if let Some(x) = args.Message { builder.add_Message(x); } if let Some(x) = args.Message { builder.add_Message(x); }
builder.add_Message_type(args.Message_type); builder.add_Message_type(args.Message_type);
@@ -50,17 +43,17 @@ impl<'a> GameMessageWrapper<'a> {
pub fn unpack(&self) -> GameMessageWrapperT { pub fn unpack(&self) -> GameMessageWrapperT {
let Message = match self.Message_type() { let Message = match self.Message_type() {
GameMessage::NONE => GameMessageT::NONE, GameMessage::NONE => GameMessageT::NONE,
GameMessage::PlayerStatEvent => GameMessageT::PlayerStatEvent(Box::new( GameMessage::PlayerStatEvent => GameMessageT::PlayerStatEvent(alloc::boxed::Box::new(
self.Message_as_player_stat_event() self.Message_as_player_stat_event()
.expect("Invalid union table, expected `GameMessage::PlayerStatEvent`.") .expect("Invalid union table, expected `GameMessage::PlayerStatEvent`.")
.unpack() .unpack()
)), )),
GameMessage::PlayerSpectate => GameMessageT::PlayerSpectate(Box::new( GameMessage::PlayerSpectate => GameMessageT::PlayerSpectate(alloc::boxed::Box::new(
self.Message_as_player_spectate() self.Message_as_player_spectate()
.expect("Invalid union table, expected `GameMessage::PlayerSpectate`.") .expect("Invalid union table, expected `GameMessage::PlayerSpectate`.")
.unpack() .unpack()
)), )),
GameMessage::PlayerInputChange => GameMessageT::PlayerInputChange(Box::new( GameMessage::PlayerInputChange => GameMessageT::PlayerInputChange(alloc::boxed::Box::new(
self.Message_as_player_input_change() self.Message_as_player_input_change()
.expect("Invalid union table, expected `GameMessage::PlayerInputChange`.") .expect("Invalid union table, expected `GameMessage::PlayerInputChange`.")
.unpack() .unpack()
@@ -80,11 +73,11 @@ impl<'a> GameMessageWrapper<'a> {
unsafe { self._tab.get::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Some(GameMessage::NONE)).unwrap()} unsafe { self._tab.get::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Some(GameMessage::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn Message(&self) -> Option<flatbuffers::Table<'a>> { pub fn Message(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(GameMessageWrapper::VT_MESSAGE, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(GameMessageWrapper::VT_MESSAGE, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
@@ -133,18 +126,17 @@ impl<'a> GameMessageWrapper<'a> {
} }
impl flatbuffers::Verifiable for GameMessageWrapper<'_> { impl ::flatbuffers::Verifiable for GameMessageWrapper<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_union::<GameMessage, _>("Message_type", Self::VT_MESSAGE_TYPE, "Message", Self::VT_MESSAGE, false, |key, v, pos| { .visit_union::<GameMessage, _>("Message_type", Self::VT_MESSAGE_TYPE, "Message", Self::VT_MESSAGE, false, |key, v, pos| {
match key { match key {
GameMessage::PlayerStatEvent => v.verify_union_variant::<flatbuffers::ForwardsUOffset<PlayerStatEvent>>("GameMessage::PlayerStatEvent", pos), GameMessage::PlayerStatEvent => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<PlayerStatEvent>>("GameMessage::PlayerStatEvent", pos),
GameMessage::PlayerSpectate => v.verify_union_variant::<flatbuffers::ForwardsUOffset<PlayerSpectate>>("GameMessage::PlayerSpectate", pos), GameMessage::PlayerSpectate => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<PlayerSpectate>>("GameMessage::PlayerSpectate", pos),
GameMessage::PlayerInputChange => v.verify_union_variant::<flatbuffers::ForwardsUOffset<PlayerInputChange>>("GameMessage::PlayerInputChange", pos), GameMessage::PlayerInputChange => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<PlayerInputChange>>("GameMessage::PlayerInputChange", pos),
_ => Ok(()), _ => Ok(()),
} }
})? })?
@@ -154,7 +146,7 @@ impl flatbuffers::Verifiable for GameMessageWrapper<'_> {
} }
pub struct GameMessageWrapperArgs { pub struct GameMessageWrapperArgs {
pub Message_type: GameMessage, pub Message_type: GameMessage,
pub Message: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>, pub Message: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
} }
impl<'a> Default for GameMessageWrapperArgs { impl<'a> Default for GameMessageWrapperArgs {
#[inline] #[inline]
@@ -166,21 +158,21 @@ impl<'a> Default for GameMessageWrapperArgs {
} }
} }
pub struct GameMessageWrapperBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct GameMessageWrapperBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_Message_type(&mut self, Message_type: GameMessage) { pub fn add_Message_type(&mut self, Message_type: GameMessage) {
self.fbb_.push_slot::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Message_type, GameMessage::NONE); self.fbb_.push_slot::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Message_type, GameMessage::NONE);
} }
#[inline] #[inline]
pub fn add_Message(&mut self, Message: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) { pub fn add_Message(&mut self, Message: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(GameMessageWrapper::VT_MESSAGE, Message); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(GameMessageWrapper::VT_MESSAGE, Message);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GameMessageWrapperBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameMessageWrapperBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
GameMessageWrapperBuilder { GameMessageWrapperBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -188,14 +180,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a, '
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<GameMessageWrapper<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<GameMessageWrapper<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for GameMessageWrapper<'_> { impl ::core::fmt::Debug for GameMessageWrapper<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("GameMessageWrapper"); let mut ds = f.debug_struct("GameMessageWrapper");
ds.field("Message_type", &self.Message_type()); ds.field("Message_type", &self.Message_type());
match self.Message_type() { match self.Message_type() {
@@ -241,10 +233,10 @@ impl Default for GameMessageWrapperT {
} }
} }
impl GameMessageWrapperT { impl GameMessageWrapperT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<GameMessageWrapper<'b>> { ) -> ::flatbuffers::WIPOffset<GameMessageWrapper<'b>> {
let Message_type = self.Message.game_message_type(); let Message_type = self.Message.game_message_type();
let Message = self.Message.pack(_fbb); let Message = self.Message.pack(_fbb);
GameMessageWrapper::create(_fbb, &GameMessageWrapperArgs{ GameMessageWrapper::create(_fbb, &GameMessageWrapperArgs{

View File

@@ -1,26 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum PlayerInputChangeOffset {} pub enum PlayerInputChangeOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct PlayerInputChange<'a> { pub struct PlayerInputChange<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for PlayerInputChange<'a> { impl<'a> ::flatbuffers::Follow<'a> for PlayerInputChange<'a> {
type Inner = PlayerInputChange<'a>; type Inner = PlayerInputChange<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -31,14 +24,14 @@ impl<'a> PlayerInputChange<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PlayerInputChange { _tab: table } PlayerInputChange { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args PlayerInputChangeArgs _args: &'args PlayerInputChangeArgs
) -> flatbuffers::WIPOffset<PlayerInputChange<'bldr>> { ) -> ::flatbuffers::WIPOffset<PlayerInputChange<'bldr>> {
let mut builder = PlayerInputChangeBuilder::new(_fbb); let mut builder = PlayerInputChangeBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -49,12 +42,11 @@ impl<'a> PlayerInputChange<'a> {
} }
} }
impl flatbuffers::Verifiable for PlayerInputChange<'_> { impl ::flatbuffers::Verifiable for PlayerInputChange<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -70,13 +62,13 @@ impl<'a> Default for PlayerInputChangeArgs {
} }
} }
pub struct PlayerInputChangeBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct PlayerInputChangeBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerInputChangeBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerInputChangeBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
PlayerInputChangeBuilder { PlayerInputChangeBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -84,14 +76,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a, 'b
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<PlayerInputChange<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerInputChange<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for PlayerInputChange<'_> { impl ::core::fmt::Debug for PlayerInputChange<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("PlayerInputChange"); let mut ds = f.debug_struct("PlayerInputChange");
ds.finish() ds.finish()
} }
@@ -107,10 +99,10 @@ impl Default for PlayerInputChangeT {
} }
} }
impl PlayerInputChangeT { impl PlayerInputChangeT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<PlayerInputChange<'b>> { ) -> ::flatbuffers::WIPOffset<PlayerInputChange<'b>> {
PlayerInputChange::create(_fbb, &PlayerInputChangeArgs{ PlayerInputChange::create(_fbb, &PlayerInputChangeArgs{
}) })
} }

View File

@@ -1,26 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum PlayerSpectateOffset {} pub enum PlayerSpectateOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct PlayerSpectate<'a> { pub struct PlayerSpectate<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for PlayerSpectate<'a> { impl<'a> ::flatbuffers::Follow<'a> for PlayerSpectate<'a> {
type Inner = PlayerSpectate<'a>; type Inner = PlayerSpectate<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -31,14 +24,14 @@ impl<'a> PlayerSpectate<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PlayerSpectate { _tab: table } PlayerSpectate { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args PlayerSpectateArgs _args: &'args PlayerSpectateArgs
) -> flatbuffers::WIPOffset<PlayerSpectate<'bldr>> { ) -> ::flatbuffers::WIPOffset<PlayerSpectate<'bldr>> {
let mut builder = PlayerSpectateBuilder::new(_fbb); let mut builder = PlayerSpectateBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -49,12 +42,11 @@ impl<'a> PlayerSpectate<'a> {
} }
} }
impl flatbuffers::Verifiable for PlayerSpectate<'_> { impl ::flatbuffers::Verifiable for PlayerSpectate<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -70,13 +62,13 @@ impl<'a> Default for PlayerSpectateArgs {
} }
} }
pub struct PlayerSpectateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct PlayerSpectateBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerSpectateBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerSpectateBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
PlayerSpectateBuilder { PlayerSpectateBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -84,14 +76,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b, A
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<PlayerSpectate<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerSpectate<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for PlayerSpectate<'_> { impl ::core::fmt::Debug for PlayerSpectate<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("PlayerSpectate"); let mut ds = f.debug_struct("PlayerSpectate");
ds.finish() ds.finish()
} }
@@ -107,10 +99,10 @@ impl Default for PlayerSpectateT {
} }
} }
impl PlayerSpectateT { impl PlayerSpectateT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<PlayerSpectate<'b>> { ) -> ::flatbuffers::WIPOffset<PlayerSpectate<'b>> {
PlayerSpectate::create(_fbb, &PlayerSpectateArgs{ PlayerSpectate::create(_fbb, &PlayerSpectateArgs{
}) })
} }

View File

@@ -1,26 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum PlayerStatEventOffset {} pub enum PlayerStatEventOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct PlayerStatEvent<'a> { pub struct PlayerStatEvent<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for PlayerStatEvent<'a> { impl<'a> ::flatbuffers::Follow<'a> for PlayerStatEvent<'a> {
type Inner = PlayerStatEvent<'a>; type Inner = PlayerStatEvent<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
@@ -31,14 +24,14 @@ impl<'a> PlayerStatEvent<'a> {
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PlayerStatEvent { _tab: table } PlayerStatEvent { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
_args: &'args PlayerStatEventArgs _args: &'args PlayerStatEventArgs
) -> flatbuffers::WIPOffset<PlayerStatEvent<'bldr>> { ) -> ::flatbuffers::WIPOffset<PlayerStatEvent<'bldr>> {
let mut builder = PlayerStatEventBuilder::new(_fbb); let mut builder = PlayerStatEventBuilder::new(_fbb);
builder.finish() builder.finish()
} }
@@ -49,12 +42,11 @@ impl<'a> PlayerStatEvent<'a> {
} }
} }
impl flatbuffers::Verifiable for PlayerStatEvent<'_> { impl ::flatbuffers::Verifiable for PlayerStatEvent<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.finish(); .finish();
Ok(()) Ok(())
@@ -70,13 +62,13 @@ impl<'a> Default for PlayerStatEventArgs {
} }
} }
pub struct PlayerStatEventBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct PlayerStatEventBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerStatEventBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerStatEventBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
PlayerStatEventBuilder { PlayerStatEventBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -84,14 +76,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<PlayerStatEvent<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerStatEvent<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for PlayerStatEvent<'_> { impl ::core::fmt::Debug for PlayerStatEvent<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("PlayerStatEvent"); let mut ds = f.debug_struct("PlayerStatEvent");
ds.finish() ds.finish()
} }
@@ -107,10 +99,10 @@ impl Default for PlayerStatEventT {
} }
} }
impl PlayerStatEventT { impl PlayerStatEventT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<PlayerStatEvent<'b>> { ) -> ::flatbuffers::WIPOffset<PlayerStatEvent<'b>> {
PlayerStatEvent::create(_fbb, &PlayerStatEventArgs{ PlayerStatEvent::create(_fbb, &PlayerStatEventArgs{
}) })
} }

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
// struct PossiblyReservedWords, aligned to 4 // struct PossiblyReservedWords, aligned to 4
#[repr(transparent)] #[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for PossiblyReservedWords {
Self([0; 16]) Self([0; 16])
} }
} }
impl core::fmt::Debug for PossiblyReservedWords { impl ::core::fmt::Debug for PossiblyReservedWords {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("PossiblyReservedWords") f.debug_struct("PossiblyReservedWords")
.field("follow_", &self.follow_()) .field("follow_", &self.follow_())
.field("push_", &self.push_()) .field("push_", &self.push_())
@@ -29,40 +22,39 @@ impl core::fmt::Debug for PossiblyReservedWords {
} }
} }
impl flatbuffers::SimpleToVerifyInSlice for PossiblyReservedWords {} impl ::flatbuffers::SimpleToVerifyInSlice for PossiblyReservedWords {}
impl<'a> flatbuffers::Follow<'a> for PossiblyReservedWords { impl<'a> ::flatbuffers::Follow<'a> for PossiblyReservedWords {
type Inner = &'a PossiblyReservedWords; type Inner = &'a PossiblyReservedWords;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a PossiblyReservedWords>::follow(buf, loc) } unsafe { <&'a PossiblyReservedWords>::follow(buf, loc) }
} }
} }
impl<'a> flatbuffers::Follow<'a> for &'a PossiblyReservedWords { impl<'a> ::flatbuffers::Follow<'a> for &'a PossiblyReservedWords {
type Inner = &'a PossiblyReservedWords; type Inner = &'a PossiblyReservedWords;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<PossiblyReservedWords>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<PossiblyReservedWords>(buf, loc) }
} }
} }
impl<'b> flatbuffers::Push for PossiblyReservedWords { impl<'b> ::flatbuffers::Push for PossiblyReservedWords {
type Output = PossiblyReservedWords; type Output = PossiblyReservedWords;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const PossiblyReservedWords as *const u8, <Self as flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const PossiblyReservedWords as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
} }
} }
impl<'a> flatbuffers::Verifiable for PossiblyReservedWords { impl<'a> ::flatbuffers::Verifiable for PossiblyReservedWords {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos) v.in_buffer::<Self>(pos)
} }
} }
@@ -88,117 +80,117 @@ impl<'a> PossiblyReservedWords {
} }
pub fn follow_(&self) -> f32 { pub fn follow_(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(), self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_follow_(&mut self, x: f32) { pub fn set_follow_(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(), self.0[0..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn push_(&self) -> f32 { pub fn push_(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(), self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_push_(&mut self, x: f32) { pub fn set_push_(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[4..].as_mut_ptr(), self.0[4..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn size(&self) -> f32 { pub fn size(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(), self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_size(&mut self, x: f32) { pub fn set_size(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[8..].as_mut_ptr(), self.0[8..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }
pub fn alignment(&self) -> f32 { pub fn alignment(&self) -> f32 {
let mut mem = core::mem::MaybeUninit::<<f32 as EndianScalar>::Scalar>::uninit(); let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe { ::flatbuffers::EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
self.0[12..].as_ptr(), self.0[12..].as_ptr(),
mem.as_mut_ptr() as *mut u8, mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
mem.assume_init() mem.assume_init()
}) })
} }
pub fn set_alignment(&mut self, x: f32) { pub fn set_alignment(&mut self, x: f32) {
let x_le = x.to_little_endian(); let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety: // Safety:
// Created from a valid Table for this object // Created from a valid Table for this object
// Which contains a valid value in this slot // Which contains a valid value in this slot
unsafe { unsafe {
core::ptr::copy_nonoverlapping( ::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8, &x_le as *const _ as *const u8,
self.0[12..].as_mut_ptr(), self.0[12..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(), ::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
); );
} }
} }

View File

@@ -1,46 +1,39 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*; use super::*;
pub enum RootTableOffset {} pub enum RootTableOffset {}
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct RootTable<'a> { pub struct RootTable<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for RootTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for RootTable<'a> {
type Inner = RootTable<'a>; type Inner = RootTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
} }
} }
impl<'a> RootTable<'a> { impl<'a> RootTable<'a> {
pub const VT_FIELD42_TYPE: flatbuffers::VOffsetT = 4; pub const VT_FIELD42_TYPE: ::flatbuffers::VOffsetT = 4;
pub const VT_FIELD42: flatbuffers::VOffsetT = 6; pub const VT_FIELD42: ::flatbuffers::VOffsetT = 6;
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"RustNamerTest.RootTable" "RustNamerTest.RootTable"
} }
#[inline] #[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
RootTable { _tab: table } RootTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args RootTableArgs args: &'args RootTableArgs
) -> flatbuffers::WIPOffset<RootTable<'bldr>> { ) -> ::flatbuffers::WIPOffset<RootTable<'bldr>> {
let mut builder = RootTableBuilder::new(_fbb); let mut builder = RootTableBuilder::new(_fbb);
if let Some(x) = args.field42 { builder.add_field42(x); } if let Some(x) = args.field42 { builder.add_field42(x); }
builder.add_field42_type(args.field42_type); builder.add_field42_type(args.field42_type);
@@ -50,7 +43,7 @@ impl<'a> RootTable<'a> {
pub fn unpack(&self) -> RootTableT { pub fn unpack(&self) -> RootTableT {
let field42 = match self.field42_type() { let field42 = match self.field42_type() {
FieldUnion::NONE => FieldUnionT::NONE, FieldUnion::NONE => FieldUnionT::NONE,
FieldUnion::f => FieldUnionT::F(Box::new( FieldUnion::f => FieldUnionT::F(alloc::boxed::Box::new(
self.field42_as_f() self.field42_as_f()
.expect("Invalid union table, expected `FieldUnion::f`.") .expect("Invalid union table, expected `FieldUnion::f`.")
.unpack() .unpack()
@@ -70,11 +63,11 @@ impl<'a> RootTable<'a> {
unsafe { self._tab.get::<FieldUnion>(RootTable::VT_FIELD42_TYPE, Some(FieldUnion::NONE)).unwrap()} unsafe { self._tab.get::<FieldUnion>(RootTable::VT_FIELD42_TYPE, Some(FieldUnion::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn field42(&self) -> Option<flatbuffers::Table<'a>> { pub fn field42(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(RootTable::VT_FIELD42, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(RootTable::VT_FIELD42, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
@@ -93,16 +86,15 @@ impl<'a> RootTable<'a> {
} }
impl flatbuffers::Verifiable for RootTable<'_> { impl ::flatbuffers::Verifiable for RootTable<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)? v.visit_table(pos)?
.visit_union::<FieldUnion, _>("field42_type", Self::VT_FIELD42_TYPE, "field42", Self::VT_FIELD42, false, |key, v, pos| { .visit_union::<FieldUnion, _>("field42_type", Self::VT_FIELD42_TYPE, "field42", Self::VT_FIELD42, false, |key, v, pos| {
match key { match key {
FieldUnion::f => v.verify_union_variant::<flatbuffers::ForwardsUOffset<FieldTable>>("FieldUnion::f", pos), FieldUnion::f => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<FieldTable>>("FieldUnion::f", pos),
_ => Ok(()), _ => Ok(()),
} }
})? })?
@@ -112,7 +104,7 @@ impl flatbuffers::Verifiable for RootTable<'_> {
} }
pub struct RootTableArgs { pub struct RootTableArgs {
pub field42_type: FieldUnion, pub field42_type: FieldUnion,
pub field42: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>, pub field42: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
} }
impl<'a> Default for RootTableArgs { impl<'a> Default for RootTableArgs {
#[inline] #[inline]
@@ -124,21 +116,21 @@ impl<'a> Default for RootTableArgs {
} }
} }
pub struct RootTableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { pub struct RootTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_field42_type(&mut self, field42_type: FieldUnion) { pub fn add_field42_type(&mut self, field42_type: FieldUnion) {
self.fbb_.push_slot::<FieldUnion>(RootTable::VT_FIELD42_TYPE, field42_type, FieldUnion::NONE); self.fbb_.push_slot::<FieldUnion>(RootTable::VT_FIELD42_TYPE, field42_type, FieldUnion::NONE);
} }
#[inline] #[inline]
pub fn add_field42(&mut self, field42: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) { pub fn add_field42(&mut self, field42: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(RootTable::VT_FIELD42, field42); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(RootTable::VT_FIELD42, field42);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> RootTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> RootTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
RootTableBuilder { RootTableBuilder {
fbb_: _fbb, fbb_: _fbb,
@@ -146,14 +138,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> {
} }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<RootTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<RootTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value()) ::flatbuffers::WIPOffset::new(o.value())
} }
} }
impl core::fmt::Debug for RootTable<'_> { impl ::core::fmt::Debug for RootTable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("RootTable"); let mut ds = f.debug_struct("RootTable");
ds.field("field42_type", &self.field42_type()); ds.field("field42_type", &self.field42_type());
match self.field42_type() { match self.field42_type() {
@@ -185,10 +177,10 @@ impl Default for RootTableT {
} }
} }
impl RootTableT { impl RootTableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A> _fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<RootTable<'b>> { ) -> ::flatbuffers::WIPOffset<RootTable<'b>> {
let field42_type = self.field42.field_union_type(); let field42_type = self.field42.field_union_type();
let field42 = self.field42.pack(_fbb); let field42 = self.field42.pack(_fbb);
RootTable::create(_fbb, &RootTableArgs{ RootTable::create(_fbb, &RootTableArgs{