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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct ArrayStruct, aligned to 8
#[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for ArrayStruct {
Self([0; 160])
}
}
impl core::fmt::Debug for ArrayStruct {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for ArrayStruct {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("ArrayStruct")
.field("a", &self.a())
.field("b", &self.b())
@@ -31,40 +24,39 @@ impl core::fmt::Debug for ArrayStruct {
}
}
impl flatbuffers::SimpleToVerifyInSlice for ArrayStruct {}
impl<'a> flatbuffers::Follow<'a> for ArrayStruct {
impl ::flatbuffers::SimpleToVerifyInSlice for ArrayStruct {}
impl<'a> ::flatbuffers::Follow<'a> for ArrayStruct {
type Inner = &'a ArrayStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
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;
#[inline]
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;
#[inline]
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);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8)
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8)
}
}
impl<'a> flatbuffers::Verifiable for ArrayStruct {
impl<'a> ::flatbuffers::Verifiable for ArrayStruct {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
@@ -94,82 +86,84 @@ impl<'a> ArrayStruct {
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping(
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
core::ptr::copy_nonoverlapping(
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
core::mem::size_of::<<f32 as EndianScalar>::Scalar>(),
::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:
// Created from a valid Table for this object
// 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]) {
// Safety:
// Created from a valid Table for this object
// 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 {
let mut mem = core::mem::MaybeUninit::<<i8 as EndianScalar>::Scalar>::uninit();
let mut mem = ::core::mem::MaybeUninit::<<i8 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping(
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[64..].as_ptr(),
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()
})
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
core::ptr::copy_nonoverlapping(
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
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:
// Created from a valid Table for this object
// 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]) {
@@ -177,7 +171,7 @@ impl<'a> ArrayStruct {
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe {
core::ptr::copy(
::core::ptr::copy(
x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(72),
64,
@@ -186,46 +180,47 @@ impl<'a> ArrayStruct {
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping(
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[136..].as_ptr(),
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()
})
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
core::ptr::copy_nonoverlapping(
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
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:
// Created from a valid Table for this object
// 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]) {
// Safety:
// Created from a valid Table for this object
// 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 {
@@ -233,7 +228,7 @@ impl<'a> ArrayStruct {
a: self.a(),
b: self.b().into(),
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(),
f: self.f().into(),
}
@@ -255,7 +250,7 @@ impl ArrayStructT {
self.a,
&self.b,
self.c,
&flatbuffers::array_init(|i| self.d[i].pack()),
&::flatbuffers::array_init(|i| self.d[i].pack()),
self.e,
&self.f,
)

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct NestedStruct, aligned to 8
#[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for NestedStruct {
Self([0; 32])
}
}
impl core::fmt::Debug for NestedStruct {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for NestedStruct {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("NestedStruct")
.field("a", &self.a())
.field("b", &self.b())
@@ -29,40 +22,39 @@ impl core::fmt::Debug for NestedStruct {
}
}
impl flatbuffers::SimpleToVerifyInSlice for NestedStruct {}
impl<'a> flatbuffers::Follow<'a> for NestedStruct {
impl ::flatbuffers::SimpleToVerifyInSlice for NestedStruct {}
impl<'a> ::flatbuffers::Follow<'a> for NestedStruct {
type Inner = &'a NestedStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
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;
#[inline]
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;
#[inline]
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);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8)
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8)
}
}
impl<'a> flatbuffers::Verifiable for NestedStruct {
impl<'a> ::flatbuffers::Verifiable for NestedStruct {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
@@ -87,54 +79,56 @@ impl<'a> 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:
// Created from a valid Table for this object
// 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]) {
// Safety:
// Created from a valid Table for this object
// 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 {
let mut mem = core::mem::MaybeUninit::<<TestEnum as EndianScalar>::Scalar>::uninit();
let mut mem = ::core::mem::MaybeUninit::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping(
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<TestEnum as EndianScalar>::Scalar>(),
::core::mem::size_of::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
core::ptr::copy_nonoverlapping(
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
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:
// Created from a valid Table for this object
// 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]) {
@@ -142,7 +136,7 @@ impl<'a> NestedStruct {
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe {
core::ptr::copy(
::core::ptr::copy(
x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(9),
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:
// Created from a valid Table for this object
// 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]) {
// Safety:
// Created from a valid Table for this object
// 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 {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_TEST_ENUM: i8 = 0;
@@ -47,8 +40,8 @@ impl TestEnum {
}
}
}
impl core::fmt::Debug for TestEnum {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for TestEnum {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for TestEnum {
impl ::flatbuffers::Push for TestEnum {
type Output = TestEnum;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -39,8 +32,8 @@ impl FromInclude {
}
}
}
impl core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for FromInclude {
impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); }
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
}
}
impl flatbuffers::EndianScalar for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>,
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>;
#[inline]
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> {
pub const VT_A: flatbuffers::VOffsetT = 4;
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> {
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
Box::new(x.unpack())
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
@@ -59,24 +52,23 @@ impl<'a> TableB<'a> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl flatbuffers::Verifiable for TableB<'_> {
impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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();
Ok(())
}
}
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> {
#[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableBArgs<'a> {
}
}
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>,
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableBT {
}
}
impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});

View File

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

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -39,8 +32,8 @@ impl FromInclude {
}
}
}
impl core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for FromInclude {
impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); }
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
}
}
impl flatbuffers::EndianScalar for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>,
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>;
#[inline]
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> {
pub const VT_A: flatbuffers::VOffsetT = 4;
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> {
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
Box::new(x.unpack())
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
@@ -59,24 +52,23 @@ impl<'a> TableB<'a> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl flatbuffers::Verifiable for TableB<'_> {
impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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();
Ok(())
}
}
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> {
#[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableBArgs<'a> {
}
}
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>,
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableBT {
}
}
impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});

View File

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

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ABC: i32 = 0;
@@ -47,8 +40,8 @@ impl ABC {
}
}
}
impl core::fmt::Debug for ABC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for ABC {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for ABC {
impl ::flatbuffers::Push for ABC {
type Output = ABC;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum KeywordsInTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct KeywordsInTable<'a> {
pub _tab: flatbuffers::Table<'a>,
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>;
#[inline]
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> {
pub const VT_IS: flatbuffers::VOffsetT = 4;
pub const VT_PRIVATE: flatbuffers::VOffsetT = 6;
pub const VT_TYPE_: flatbuffers::VOffsetT = 8;
pub const VT_DEFAULT: flatbuffers::VOffsetT = 10;
pub const VT_IS: ::flatbuffers::VOffsetT = 4;
pub const VT_PRIVATE: ::flatbuffers::VOffsetT = 6;
pub const VT_TYPE_: ::flatbuffers::VOffsetT = 8;
pub const VT_DEFAULT: ::flatbuffers::VOffsetT = 10;
pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.KeywordsInTable"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
KeywordsInTable { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args KeywordsInTableArgs
) -> flatbuffers::WIPOffset<KeywordsInTable<'bldr>> {
) -> ::flatbuffers::WIPOffset<KeywordsInTable<'bldr>> {
let mut builder = KeywordsInTableBuilder::new(_fbb);
builder.add_type_(args.type_);
builder.add_private(args.private);
@@ -94,12 +87,11 @@ impl<'a> KeywordsInTable<'a> {
}
}
impl flatbuffers::Verifiable for KeywordsInTable<'_> {
impl ::flatbuffers::Verifiable for KeywordsInTable<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<ABC>("is", Self::VT_IS, 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> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct KeywordsInTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> {
#[inline]
pub fn add_is(&mut self, is: ABC) {
self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void);
@@ -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);
}
#[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();
KeywordsInTableBuilder {
fbb_: _fbb,
@@ -157,14 +149,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b,
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for KeywordsInTable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for KeywordsInTable<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("KeywordsInTable");
ds.field("is", &self.is());
ds.field("private", &self.private());
@@ -192,10 +184,10 @@ impl Default for KeywordsInTableT {
}
}
impl KeywordsInTableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<KeywordsInTable<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<KeywordsInTable<'b>> {
let is = self.is;
let private = self.private;
let type_ = self.type_;

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0;
@@ -47,8 +40,8 @@ impl KeywordsInUnion {
}
}
}
impl core::fmt::Debug for KeywordsInUnion {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for KeywordsInUnion {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for KeywordsInUnion {
impl ::flatbuffers::Push for KeywordsInUnion {
type Output = KeywordsInUnion;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {}
impl ::flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {}
pub struct KeywordsInUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -105,8 +97,8 @@ pub struct KeywordsInUnionUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)]
pub enum KeywordsInUnionT {
NONE,
Static_(Box<KeywordsInTableT>),
Internal(Box<KeywordsInTableT>),
Static_(alloc::boxed::Box<KeywordsInTableT>),
Internal(alloc::boxed::Box<KeywordsInTableT>),
}
impl Default for KeywordsInUnionT {
fn default() -> Self {
@@ -121,7 +113,7 @@ impl KeywordsInUnionT {
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 {
Self::NONE => None,
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.
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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Static_(w) = v {
Some(w)
} else {
@@ -150,9 +142,9 @@ impl KeywordsInUnionT {
if let Self::Static_(v) = self { Some(v.as_mut()) } else { None }
}
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_internal(&mut self) -> Option<Box<KeywordsInTableT>> {
pub fn take_internal(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
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 {
Some(w)
} else {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,17 +1,10 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]
mod bitflags_color {
flatbuffers::bitflags::bitflags! {
::flatbuffers::bitflags::bitflags! {
/// Composite components of Monster color.
#[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct Color: u8 {
@@ -26,24 +19,24 @@ mod bitflags_color {
}
pub use self::bitflags_color::Color;
impl<'a> flatbuffers::Follow<'a> for Color {
impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self::from_bits_retain(b)
}
}
impl flatbuffers::Push for Color {
impl ::flatbuffers::Push for Color {
type Output = Color;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.bits()); }
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
}
}
impl flatbuffers::EndianScalar for Color {
impl ::flatbuffers::EndianScalar for Color {
type Scalar = u8;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]
mod bitflags_long_enum {
flatbuffers::bitflags::bitflags! {
::flatbuffers::bitflags::bitflags! {
#[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct LongEnum: u64 {
const LongOne = 2;
@@ -22,24 +15,24 @@ mod bitflags_long_enum {
}
pub use self::bitflags_long_enum::LongEnum;
impl<'a> flatbuffers::Follow<'a> for LongEnum {
impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { flatbuffers::read_scalar_at::<u64>(buf, loc) };
let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) };
Self::from_bits_retain(b)
}
}
impl flatbuffers::Push for LongEnum {
impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u64>(dst, self.bits()); }
unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
}
}
impl flatbuffers::EndianScalar for LongEnum {
impl ::flatbuffers::EndianScalar for LongEnum {
type Scalar = u64;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_RACE: i8 = -1;
@@ -51,8 +44,8 @@ impl Race {
}
}
}
impl core::fmt::Debug for Race {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for Race {
impl ::flatbuffers::Push for Race {
type Output = Race;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); }
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
}
}
impl flatbuffers::EndianScalar for Race {
impl ::flatbuffers::EndianScalar for Race {
type Scalar = i8;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Referrable<'a> {
pub _tab: flatbuffers::Table<'a>,
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>;
#[inline]
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> {
pub const VT_ID: flatbuffers::VOffsetT = 4;
pub const VT_ID: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.Referrable"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Referrable { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ReferrableArgs
) -> flatbuffers::WIPOffset<Referrable<'bldr>> {
) -> ::flatbuffers::WIPOffset<Referrable<'bldr>> {
let mut builder = ReferrableBuilder::new(_fbb);
builder.add_id(args.id);
builder.finish()
@@ -71,12 +64,11 @@ impl<'a> Referrable<'a> {
}
}
impl flatbuffers::Verifiable for Referrable<'_> {
impl ::flatbuffers::Verifiable for Referrable<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<u64>("id", Self::VT_ID, false)?
.finish();
@@ -95,17 +87,17 @@ impl<'a> Default for ReferrableArgs {
}
}
pub struct ReferrableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct ReferrableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
#[inline]
pub fn add_id(&mut self, id: u64) {
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ReferrableBuilder {
fbb_: _fbb,
@@ -113,14 +105,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id());
ds.finish()
@@ -139,10 +131,10 @@ impl Default for ReferrableT {
}
}
impl ReferrableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Referrable<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Referrable<'b>> {
let id = self.id;
Referrable::create(_fbb, &ReferrableArgs{
id,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
@@ -39,8 +32,8 @@ impl FromInclude {
}
}
}
impl core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for FromInclude {
impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); }
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
}
}
impl flatbuffers::EndianScalar for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: flatbuffers::Table<'a>,
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>;
#[inline]
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> {
pub const VT_A: flatbuffers::VOffsetT = 4;
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> flatbuffers::WIPOffset<TableB<'bldr>> {
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
@@ -47,7 +40,7 @@ impl<'a> TableB<'a> {
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
Box::new(x.unpack())
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
@@ -59,24 +52,23 @@ impl<'a> TableB<'a> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl flatbuffers::Verifiable for TableB<'_> {
impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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();
Ok(())
}
}
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> {
#[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for TableBArgs<'a> {
}
}
pub struct TableBBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for TableB<'_> {
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<Box<super::super::TableAT>>,
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for TableBT {
}
}
impl TableBT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableB<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,19 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]
mod bitflags_color {
flatbuffers::bitflags::bitflags! {
::flatbuffers::bitflags::bitflags! {
/// Composite components of Monster color.
#[derive(Default, Debug, Clone, Copy, PartialEq)]
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;
#[inline]
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)
}
}
impl flatbuffers::Push for Color {
impl ::flatbuffers::Push for Color {
type Output = Color;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.bits()); }
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
}
}
impl flatbuffers::EndianScalar for Color {
impl ::flatbuffers::EndianScalar for Color {
type Scalar = u8;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]
mod bitflags_long_enum {
flatbuffers::bitflags::bitflags! {
::flatbuffers::bitflags::bitflags! {
#[derive(Default, Debug, Clone, Copy, PartialEq)]
pub struct LongEnum: u64 {
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;
#[inline]
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)
}
}
impl flatbuffers::Push for LongEnum {
impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u64>(dst, self.bits()); }
unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
}
}
impl flatbuffers::EndianScalar for LongEnum {
impl ::flatbuffers::EndianScalar for LongEnum {
type Scalar = u64;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_RACE: i8 = -1;
@@ -53,8 +46,8 @@ impl Race {
}
}
}
impl core::fmt::Debug for Race {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for Race {
impl ::flatbuffers::Push for Race {
type Output = Race;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); }
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
}
}
impl flatbuffers::EndianScalar for Race {
impl ::flatbuffers::EndianScalar for Race {
type Scalar = i8;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
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>;
#[inline]
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> {
pub const VT_ID: flatbuffers::VOffsetT = 4;
pub const VT_ID: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example.Referrable"
}
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Referrable { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ReferrableArgs
) -> flatbuffers::WIPOffset<Referrable<'bldr>> {
) -> ::flatbuffers::WIPOffset<Referrable<'bldr>> {
let mut builder = ReferrableBuilder::new(_fbb);
builder.add_id(args.id);
builder.finish()
@@ -73,12 +66,11 @@ impl<'a> Referrable<'a> {
}
}
impl flatbuffers::Verifiable for Referrable<'_> {
impl ::flatbuffers::Verifiable for Referrable<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<u64>("id", Self::VT_ID, false)?
.finish();
@@ -108,17 +100,17 @@ impl Serialize for Referrable<'_> {
}
}
pub struct ReferrableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct ReferrableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
#[inline]
pub fn add_id(&mut self, id: u64) {
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ReferrableBuilder {
fbb_: _fbb,
@@ -126,14 +118,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id());
ds.finish()
@@ -152,10 +144,10 @@ impl Default for ReferrableT {
}
}
impl ReferrableT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Referrable<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Referrable<'b>> {
let id = self.id;
Referrable::create(_fbb, &ReferrableArgs{
id,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
@@ -47,8 +40,8 @@ impl EnumInNestedNS {
}
}
}
impl core::fmt::Debug for EnumInNestedNS {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for EnumInNestedNS {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for EnumInNestedNS {
impl ::flatbuffers::Push for EnumInNestedNS {
type Output = EnumInNestedNS;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct StructInNestedNS, aligned to 4
#[repr(transparent)]
@@ -18,8 +11,8 @@ impl Default for StructInNestedNS {
Self([0; 8])
}
}
impl core::fmt::Debug for StructInNestedNS {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for StructInNestedNS {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructInNestedNS")
.field("a", &self.a())
.field("b", &self.b())
@@ -27,40 +20,39 @@ impl core::fmt::Debug for StructInNestedNS {
}
}
impl flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {}
impl<'a> flatbuffers::Follow<'a> for StructInNestedNS {
impl ::flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {}
impl<'a> ::flatbuffers::Follow<'a> for StructInNestedNS {
type Inner = &'a StructInNestedNS;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
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;
#[inline]
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;
#[inline]
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);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4)
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
}
}
impl<'a> flatbuffers::Verifiable for StructInNestedNS {
impl<'a> ::flatbuffers::Verifiable for StructInNestedNS {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
@@ -82,59 +74,59 @@ impl<'a> StructInNestedNS {
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping(
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
core::ptr::copy_nonoverlapping(
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
EndianScalar::from_little_endian(unsafe {
core::ptr::copy_nonoverlapping(
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[4..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
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:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
core::ptr::copy_nonoverlapping(
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableInNestedNSOffset {}
#[derive(Copy, Clone, PartialEq)]
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>;
#[inline]
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> {
pub const VT_FOO: flatbuffers::VOffsetT = 4;
pub const VT_FOO: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"NamespaceA.NamespaceB.TableInNestedNS"
}
#[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 }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableInNestedNSArgs
) -> flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
) -> ::flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
let mut builder = TableInNestedNSBuilder::new(_fbb);
builder.add_foo(args.foo);
builder.finish()
@@ -61,12 +54,11 @@ impl<'a> TableInNestedNS<'a> {
}
}
impl flatbuffers::Verifiable for TableInNestedNS<'_> {
impl ::flatbuffers::Verifiable for TableInNestedNS<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i32>("foo", Self::VT_FOO, false)?
.finish();
@@ -85,17 +77,17 @@ impl<'a> Default for TableInNestedNSArgs {
}
}
pub struct TableInNestedNSBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct TableInNestedNSBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> {
#[inline]
pub fn add_foo(&mut self, foo: i32) {
self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
}
#[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();
TableInNestedNSBuilder {
fbb_: _fbb,
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b,
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for TableInNestedNS<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for TableInNestedNS<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableInNestedNS");
ds.field("foo", &self.foo());
ds.finish()
@@ -129,10 +121,10 @@ impl Default for TableInNestedNST {
}
}
impl TableInNestedNST {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<TableInNestedNS<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableInNestedNS<'b>> {
let foo = self.foo;
TableInNestedNS::create(_fbb, &TableInNestedNSArgs{
foo,

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0;
@@ -43,8 +36,8 @@ impl UnionInNestedNS {
}
}
}
impl core::fmt::Debug for UnionInNestedNS {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for UnionInNestedNS {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for UnionInNestedNS {
impl ::flatbuffers::Push for UnionInNestedNS {
type Output = UnionInNestedNS;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {}
impl ::flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {}
pub struct UnionInNestedNSUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -101,7 +93,7 @@ pub struct UnionInNestedNSUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)]
pub enum UnionInNestedNST {
NONE,
TableInNestedNS(Box<TableInNestedNST>),
TableInNestedNS(alloc::boxed::Box<TableInNestedNST>),
}
impl Default for UnionInNestedNST {
fn default() -> Self {
@@ -115,16 +107,16 @@ impl UnionInNestedNST {
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 {
Self::NONE => None,
Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()),
}
}
/// 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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::TableInNestedNS(w) = v {
Some(w)
} else {

View File

@@ -1,45 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum SecondTableInAOffset {}
#[derive(Copy, Clone, PartialEq)]
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>;
#[inline]
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> {
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 {
"NamespaceA.SecondTableInA"
}
#[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 }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args SecondTableInAArgs<'args>
) -> flatbuffers::WIPOffset<SecondTableInA<'bldr>> {
) -> ::flatbuffers::WIPOffset<SecondTableInA<'bldr>> {
let mut builder = SecondTableInABuilder::new(_fbb);
if let Some(x) = args.refer_to_c { builder.add_refer_to_c(x); }
builder.finish()
@@ -47,7 +40,7 @@ impl<'a> SecondTableInA<'a> {
pub fn unpack(&self) -> SecondTableInAT {
let refer_to_c = self.refer_to_c().map(|x| {
Box::new(x.unpack())
alloc::boxed::Box::new(x.unpack())
});
SecondTableInAT {
refer_to_c,
@@ -59,24 +52,23 @@ impl<'a> SecondTableInA<'a> {
// Safety:
// Created from valid Table for this object
// 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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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();
Ok(())
}
}
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> {
#[inline]
@@ -87,17 +79,17 @@ impl<'a> Default for SecondTableInAArgs<'a> {
}
}
pub struct SecondTableInABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct SecondTableInABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> {
#[inline]
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);
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);
}
#[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();
SecondTableInABuilder {
fbb_: _fbb,
@@ -105,14 +97,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for SecondTableInA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for SecondTableInA<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("SecondTableInA");
ds.field("refer_to_c", &self.refer_to_c());
ds.finish()
@@ -121,7 +113,7 @@ impl core::fmt::Debug for SecondTableInA<'_> {
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
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 {
fn default() -> Self {
@@ -131,10 +123,10 @@ impl Default for SecondTableInAT {
}
}
impl SecondTableInAT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<SecondTableInA<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<SecondTableInA<'b>> {
let refer_to_c = self.refer_to_c.as_ref().map(|x|{
x.pack(_fbb)
});

View File

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

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0;
@@ -47,8 +40,8 @@ impl OptionalByte {
}
}
}
impl core::fmt::Debug for OptionalByte {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for OptionalByte {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for OptionalByte {
impl ::flatbuffers::Push for OptionalByte {
type Output = OptionalByte;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ScalarStuffOffset {}
#[derive(Copy, Clone, PartialEq)]
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>;
#[inline]
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> {
pub const VT_JUST_I8: flatbuffers::VOffsetT = 4;
pub const VT_MAYBE_I8: flatbuffers::VOffsetT = 6;
pub const VT_DEFAULT_I8: flatbuffers::VOffsetT = 8;
pub const VT_JUST_U8: flatbuffers::VOffsetT = 10;
pub const VT_MAYBE_U8: flatbuffers::VOffsetT = 12;
pub const VT_DEFAULT_U8: flatbuffers::VOffsetT = 14;
pub const VT_JUST_I16: flatbuffers::VOffsetT = 16;
pub const VT_MAYBE_I16: flatbuffers::VOffsetT = 18;
pub const VT_DEFAULT_I16: flatbuffers::VOffsetT = 20;
pub const VT_JUST_U16: flatbuffers::VOffsetT = 22;
pub const VT_MAYBE_U16: flatbuffers::VOffsetT = 24;
pub const VT_DEFAULT_U16: flatbuffers::VOffsetT = 26;
pub const VT_JUST_I32: flatbuffers::VOffsetT = 28;
pub const VT_MAYBE_I32: flatbuffers::VOffsetT = 30;
pub const VT_DEFAULT_I32: flatbuffers::VOffsetT = 32;
pub const VT_JUST_U32: flatbuffers::VOffsetT = 34;
pub const VT_MAYBE_U32: flatbuffers::VOffsetT = 36;
pub const VT_DEFAULT_U32: flatbuffers::VOffsetT = 38;
pub const VT_JUST_I64: flatbuffers::VOffsetT = 40;
pub const VT_MAYBE_I64: flatbuffers::VOffsetT = 42;
pub const VT_DEFAULT_I64: flatbuffers::VOffsetT = 44;
pub const VT_JUST_U64: flatbuffers::VOffsetT = 46;
pub const VT_MAYBE_U64: flatbuffers::VOffsetT = 48;
pub const VT_DEFAULT_U64: flatbuffers::VOffsetT = 50;
pub const VT_JUST_F32: flatbuffers::VOffsetT = 52;
pub const VT_MAYBE_F32: flatbuffers::VOffsetT = 54;
pub const VT_DEFAULT_F32: flatbuffers::VOffsetT = 56;
pub const VT_JUST_F64: flatbuffers::VOffsetT = 58;
pub const VT_MAYBE_F64: flatbuffers::VOffsetT = 60;
pub const VT_DEFAULT_F64: flatbuffers::VOffsetT = 62;
pub const VT_JUST_BOOL: flatbuffers::VOffsetT = 64;
pub const VT_MAYBE_BOOL: flatbuffers::VOffsetT = 66;
pub const VT_DEFAULT_BOOL: flatbuffers::VOffsetT = 68;
pub const VT_JUST_ENUM: flatbuffers::VOffsetT = 70;
pub const VT_MAYBE_ENUM: flatbuffers::VOffsetT = 72;
pub const VT_DEFAULT_ENUM: flatbuffers::VOffsetT = 74;
pub const VT_JUST_I8: ::flatbuffers::VOffsetT = 4;
pub const VT_MAYBE_I8: ::flatbuffers::VOffsetT = 6;
pub const VT_DEFAULT_I8: ::flatbuffers::VOffsetT = 8;
pub const VT_JUST_U8: ::flatbuffers::VOffsetT = 10;
pub const VT_MAYBE_U8: ::flatbuffers::VOffsetT = 12;
pub const VT_DEFAULT_U8: ::flatbuffers::VOffsetT = 14;
pub const VT_JUST_I16: ::flatbuffers::VOffsetT = 16;
pub const VT_MAYBE_I16: ::flatbuffers::VOffsetT = 18;
pub const VT_DEFAULT_I16: ::flatbuffers::VOffsetT = 20;
pub const VT_JUST_U16: ::flatbuffers::VOffsetT = 22;
pub const VT_MAYBE_U16: ::flatbuffers::VOffsetT = 24;
pub const VT_DEFAULT_U16: ::flatbuffers::VOffsetT = 26;
pub const VT_JUST_I32: ::flatbuffers::VOffsetT = 28;
pub const VT_MAYBE_I32: ::flatbuffers::VOffsetT = 30;
pub const VT_DEFAULT_I32: ::flatbuffers::VOffsetT = 32;
pub const VT_JUST_U32: ::flatbuffers::VOffsetT = 34;
pub const VT_MAYBE_U32: ::flatbuffers::VOffsetT = 36;
pub const VT_DEFAULT_U32: ::flatbuffers::VOffsetT = 38;
pub const VT_JUST_I64: ::flatbuffers::VOffsetT = 40;
pub const VT_MAYBE_I64: ::flatbuffers::VOffsetT = 42;
pub const VT_DEFAULT_I64: ::flatbuffers::VOffsetT = 44;
pub const VT_JUST_U64: ::flatbuffers::VOffsetT = 46;
pub const VT_MAYBE_U64: ::flatbuffers::VOffsetT = 48;
pub const VT_DEFAULT_U64: ::flatbuffers::VOffsetT = 50;
pub const VT_JUST_F32: ::flatbuffers::VOffsetT = 52;
pub const VT_MAYBE_F32: ::flatbuffers::VOffsetT = 54;
pub const VT_DEFAULT_F32: ::flatbuffers::VOffsetT = 56;
pub const VT_JUST_F64: ::flatbuffers::VOffsetT = 58;
pub const VT_MAYBE_F64: ::flatbuffers::VOffsetT = 60;
pub const VT_DEFAULT_F64: ::flatbuffers::VOffsetT = 62;
pub const VT_JUST_BOOL: ::flatbuffers::VOffsetT = 64;
pub const VT_MAYBE_BOOL: ::flatbuffers::VOffsetT = 66;
pub const VT_DEFAULT_BOOL: ::flatbuffers::VOffsetT = 68;
pub const VT_JUST_ENUM: ::flatbuffers::VOffsetT = 70;
pub const VT_MAYBE_ENUM: ::flatbuffers::VOffsetT = 72;
pub const VT_DEFAULT_ENUM: ::flatbuffers::VOffsetT = 74;
pub const fn get_fully_qualified_name() -> &'static str {
"optional_scalars.ScalarStuff"
}
#[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 }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ScalarStuffArgs
) -> flatbuffers::WIPOffset<ScalarStuff<'bldr>> {
) -> ::flatbuffers::WIPOffset<ScalarStuff<'bldr>> {
let mut builder = ScalarStuffBuilder::new(_fbb);
builder.add_default_f64(args.default_f64);
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i8>("just_i8", Self::VT_JUST_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> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub struct ScalarStuffBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
#[inline]
pub fn add_just_i8(&mut self, just_i8: i8) {
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);
}
#[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();
ScalarStuffBuilder {
fbb_: _fbb,
@@ -733,14 +725,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for ScalarStuff<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for ScalarStuff<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("ScalarStuff");
ds.field("just_i8", &self.just_i8());
ds.field("maybe_i8", &self.maybe_i8());
@@ -864,10 +856,10 @@ impl Default for ScalarStuffT {
}
}
impl ScalarStuffT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<ScalarStuff<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<ScalarStuff<'b>> {
let just_i8 = self.just_i8;
let maybe_i8 = self.maybe_i8;
let default_i8 = self.default_i8;
@@ -951,8 +943,8 @@ impl ScalarStuffT {
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`.
pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<ScalarStuff>(buf)
pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<ScalarStuff>(buf)
}
#[inline]
/// 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
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_scalar_stuff_unchecked`.
pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<ScalarStuff>(buf)
pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<ScalarStuff>(buf)
}
#[inline]
/// 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
/// `root_as_scalar_stuff_unchecked`.
pub fn root_as_scalar_stuff_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<ScalarStuff<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<ScalarStuff<'b>>(opts, buf)
) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<ScalarStuff<'b>>(opts, buf)
}
#[inline]
/// 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
/// `root_as_scalar_stuff_unchecked`.
pub fn size_prefixed_root_as_scalar_stuff_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<ScalarStuff<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<ScalarStuff<'b>>(opts, buf)
) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<ScalarStuff<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a ScalarStuff and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `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]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ScalarStuff and returns it.
/// # Safety
/// 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<'_> {
unsafe { flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) }
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) }
}
pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL";
#[inline]
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]
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";
#[inline]
pub fn finish_scalar_stuff_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<ScalarStuff<'a>>) {
pub fn finish_scalar_stuff_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<ScalarStuff<'a>>) {
fbb.finish(root, Some(SCALAR_STUFF_IDENTIFIER));
}
#[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));
}

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_AB: i8 = 0;
@@ -43,8 +36,8 @@ impl AB {
}
}
}
impl core::fmt::Debug for AB {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for AB {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for AB {
impl ::flatbuffers::Push for AB {
type Output = AB;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
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
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub(crate) enum AnnotationsOffset {}
#[derive(Copy, Clone, PartialEq)]
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>;
#[inline]
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> {
pub const VT_VALUE: flatbuffers::VOffsetT = 4;
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"Annotations"
}
#[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 }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args AnnotationsArgs
) -> flatbuffers::WIPOffset<Annotations<'bldr>> {
) -> ::flatbuffers::WIPOffset<Annotations<'bldr>> {
let mut builder = AnnotationsBuilder::new(_fbb);
builder.add_value(args.value);
builder.finish()
@@ -61,12 +54,11 @@ impl<'a> Annotations<'a> {
}
}
impl flatbuffers::Verifiable for Annotations<'_> {
impl ::flatbuffers::Verifiable for Annotations<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish();
@@ -85,17 +77,17 @@ impl<'a> Default for AnnotationsArgs {
}
}
pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
#[inline]
pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
}
#[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();
AnnotationsBuilder {
fbb_: _fbb,
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
}
}
#[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_);
flatbuffers::WIPOffset::new(o.value())
::flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Annotations<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ::core::fmt::Debug for Annotations<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Annotations");
ds.field("value", &self.value());
ds.finish()
@@ -129,10 +121,10 @@ impl Default for AnnotationsT {
}
}
impl AnnotationsT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Annotations<'b>> {
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Annotations<'b>> {
let value = self.value;
Annotations::create(_fbb, &AnnotationsArgs{
value,

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY: u8 = 0;
@@ -47,8 +40,8 @@ impl Any {
}
}
}
impl core::fmt::Debug for Any {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -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;
#[inline]
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)
}
}
impl flatbuffers::Push for Any {
impl ::flatbuffers::Push for Any {
type Output = Any;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
}
}
impl flatbuffers::EndianScalar for Any {
impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for Any {}
impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub(crate) struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -105,8 +97,8 @@ pub(crate) struct AnyUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)]
pub(crate) enum AnyT {
NONE,
Game(Box<GameT>),
Annotations(Box<AnnotationsT>),
Game(alloc::boxed::Box<GameT>),
Annotations(alloc::boxed::Box<AnnotationsT>),
}
impl Default for AnyT {
fn default() -> Self {
@@ -121,7 +113,7 @@ impl AnyT {
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 {
Self::NONE => None,
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.
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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Game(w) = v {
Some(w)
} else {
@@ -150,9 +142,9 @@ impl AnyT {
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.
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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Annotations(w) = v {
Some(w)
} else {

View File

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

View File

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

View File

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

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FIELD_UNION: u8 = 0;
@@ -43,8 +36,8 @@ impl FieldUnion {
}
}
}
impl core::fmt::Debug for FieldUnion {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for FieldUnion {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for FieldUnion {
impl ::flatbuffers::Push for FieldUnion {
type Output = FieldUnion;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for FieldUnion {}
impl ::flatbuffers::SimpleToVerifyInSlice for FieldUnion {}
pub struct FieldUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -101,7 +93,7 @@ pub struct FieldUnionUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)]
pub enum FieldUnionT {
NONE,
F(Box<FieldTableT>),
F(alloc::boxed::Box<FieldTableT>),
}
impl Default for FieldUnionT {
fn default() -> Self {
@@ -115,16 +107,16 @@ impl FieldUnionT {
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 {
Self::NONE => None,
Self::F(v) => Some(v.pack(fbb).as_union_value()),
}
}
/// 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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::F(w) = v {
Some(w)
} else {

View File

@@ -1,13 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_GAME_MESSAGE: u8 = 0;
@@ -51,8 +44,8 @@ impl GameMessage {
}
}
}
impl core::fmt::Debug for GameMessage {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl ::core::fmt::Debug for GameMessage {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} 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;
#[inline]
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)
}
}
impl flatbuffers::Push for GameMessage {
impl ::flatbuffers::Push for GameMessage {
type Output = GameMessage;
#[inline]
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;
#[inline]
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]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for GameMessage {}
impl ::flatbuffers::SimpleToVerifyInSlice for GameMessage {}
pub struct GameMessageUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)]
@@ -109,9 +101,9 @@ pub struct GameMessageUnionTableOffset {}
#[derive(Debug, Clone, PartialEq)]
pub enum GameMessageT {
NONE,
PlayerStatEvent(Box<PlayerStatEventT>),
PlayerSpectate(Box<PlayerSpectateT>),
PlayerInputChange(Box<PlayerInputChangeT>),
PlayerStatEvent(alloc::boxed::Box<PlayerStatEventT>),
PlayerSpectate(alloc::boxed::Box<PlayerSpectateT>),
PlayerInputChange(alloc::boxed::Box<PlayerInputChangeT>),
}
impl Default for GameMessageT {
fn default() -> Self {
@@ -127,7 +119,7 @@ impl GameMessageT {
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 {
Self::NONE => None,
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.
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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::PlayerStatEvent(w) = v {
Some(w)
} else {
@@ -157,9 +149,9 @@ impl GameMessageT {
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.
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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::PlayerSpectate(w) = v {
Some(w)
} else {
@@ -178,9 +170,9 @@ impl GameMessageT {
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.
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 {
let v = core::mem::replace(self, Self::NONE);
let v = ::core::mem::replace(self, Self::NONE);
if let Self::PlayerInputChange(w) = v {
Some(w)
} else {

View File

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

View File

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

View File

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

View File

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

View File

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