Generate better formatted Rust code (#8919)

* Cleans up Rust formatting

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

View File

@@ -1,297 +1,318 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
#[allow(unused_imports, dead_code)] #[allow(unused_imports, dead_code)]
pub mod flatbuffers { pub mod flatbuffers {
extern crate alloc;
extern crate alloc; #[allow(unused_imports, dead_code)]
#[allow(unused_imports, dead_code)] pub mod goldens {
pub mod goldens { extern crate alloc;
extern crate alloc; pub enum GalaxyOffset {}
pub enum GalaxyOffset {} #[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq)] pub struct Galaxy<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
pub struct Galaxy<'a> { impl<'a> ::flatbuffers::Follow<'a> for Galaxy<'a> {
pub _tab: ::flatbuffers::Table<'a>, type Inner = Galaxy<'a>;
}
impl<'a> ::flatbuffers::Follow<'a> for Galaxy<'a> { #[inline]
type Inner = Galaxy<'a>; unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
#[inline] Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { }
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } }
}
}
impl<'a> Galaxy<'a> { impl<'a> Galaxy<'a> {
pub const VT_NUM_STARS: ::flatbuffers::VOffsetT = 4; pub const VT_NUM_STARS: ::flatbuffers::VOffsetT = 4;
#[inline] #[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Galaxy { _tab: table } Galaxy { _tab: table }
} }
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( #[allow(unused_mut)]
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
args: &'args GalaxyArgs _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
) -> ::flatbuffers::WIPOffset<Galaxy<'bldr>> { args: &'args GalaxyArgs
let mut builder = GalaxyBuilder::new(_fbb); ) -> ::flatbuffers::WIPOffset<Galaxy<'bldr>> {
builder.add_num_stars(args.num_stars); let mut builder = GalaxyBuilder::new(_fbb);
builder.finish() builder.add_num_stars(args.num_stars);
} builder.finish()
}
#[inline] #[inline]
pub fn num_stars(&self) -> i64 { pub fn num_stars(&self) -> i64 {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Galaxy::VT_NUM_STARS, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(Galaxy::VT_NUM_STARS, Some(0)).unwrap()}
} }
} }
impl ::flatbuffers::Verifiable for Galaxy<'_> { impl ::flatbuffers::Verifiable for Galaxy<'_> {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)? v.visit_table(pos)?
.visit_field::<i64>("num_stars", Self::VT_NUM_STARS, false)? .visit_field::<i64>("num_stars", Self::VT_NUM_STARS, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
}
pub struct GalaxyArgs {
pub num_stars: i64,
}
impl<'a> Default for GalaxyArgs {
#[inline]
fn default() -> Self {
GalaxyArgs {
num_stars: 0,
} }
}
}
pub struct GalaxyBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { pub struct GalaxyArgs {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, pub num_stars: i64,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GalaxyBuilder<'a, 'b, A> {
#[inline]
pub fn add_num_stars(&mut self, num_stars: i64) {
self.fbb_.push_slot::<i64>(Galaxy::VT_NUM_STARS, num_stars, 0);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GalaxyBuilder<'a, 'b, A> {
let start = _fbb.start_table();
GalaxyBuilder {
fbb_: _fbb,
start_: start,
} }
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Galaxy<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Galaxy<'_> { impl<'a> Default for GalaxyArgs {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { #[inline]
let mut ds = f.debug_struct("Galaxy"); fn default() -> Self {
ds.field("num_stars", &self.num_stars()); GalaxyArgs {
ds.finish() num_stars: 0,
} }
} }
pub enum UniverseOffset {} }
#[derive(Copy, Clone, PartialEq)]
pub struct Universe<'a> { pub struct GalaxyBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
pub _tab: ::flatbuffers::Table<'a>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
} start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a> ::flatbuffers::Follow<'a> for Universe<'a> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GalaxyBuilder<'a, 'b, A> {
type Inner = Universe<'a>; #[inline]
#[inline] pub fn add_num_stars(&mut self, num_stars: i64) {
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { self.fbb_.push_slot::<i64>(Galaxy::VT_NUM_STARS, num_stars, 0);
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } }
}
}
impl<'a> Universe<'a> { #[inline]
pub const VT_AGE: ::flatbuffers::VOffsetT = 4; pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GalaxyBuilder<'a, 'b, A> {
pub const VT_GALAXIES: ::flatbuffers::VOffsetT = 6; let start = _fbb.start_table();
GalaxyBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline] #[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub fn finish(self) -> ::flatbuffers::WIPOffset<Galaxy<'a>> {
Universe { _tab: table } let o = self.fbb_.end_table(self.start_);
} ::flatbuffers::WIPOffset::new(o.value())
#[allow(unused_mut)] }
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( }
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args UniverseArgs<'args> impl ::core::fmt::Debug for Galaxy<'_> {
) -> ::flatbuffers::WIPOffset<Universe<'bldr>> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut builder = UniverseBuilder::new(_fbb); let mut ds = f.debug_struct("Galaxy");
builder.add_age(args.age); ds.field("num_stars", &self.num_stars());
if let Some(x) = args.galaxies { builder.add_galaxies(x); } ds.finish()
builder.finish() }
} }
pub enum UniverseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Universe<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for Universe<'a> {
type Inner = Universe<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Universe<'a> {
pub const VT_AGE: ::flatbuffers::VOffsetT = 4;
pub const VT_GALAXIES: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Universe { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args UniverseArgs<'args>
) -> ::flatbuffers::WIPOffset<Universe<'bldr>> {
let mut builder = UniverseBuilder::new(_fbb);
builder.add_age(args.age);
if let Some(x) = args.galaxies { builder.add_galaxies(x); }
builder.finish()
}
#[inline] #[inline]
pub fn age(&self) -> f64 { pub fn age(&self) -> f64 {
// Safety: // Safety:
// Created from valid Table for this object // Created from valid Table for this object
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(Universe::VT_AGE, Some(0.0)).unwrap()} unsafe { self._tab.get::<f64>(Universe::VT_AGE, Some(0.0)).unwrap()}
} }
#[inline]
pub fn galaxies(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Galaxy<'a>>>> {
// 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, ::flatbuffers::ForwardsUOffset<Galaxy>>>>(Universe::VT_GALAXIES, None)}
}
}
impl ::flatbuffers::Verifiable for Universe<'_> { #[inline]
#[inline] pub fn galaxies(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Galaxy<'a>>>> {
fn run_verifier( // Safety:
v: &mut ::flatbuffers::Verifier, pos: usize // Created from valid Table for this object
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { // which contains a valid value in this slot
v.visit_table(pos)? unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Galaxy>>>>(Universe::VT_GALAXIES, None)}
}
}
impl ::flatbuffers::Verifiable for Universe<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<f64>("age", Self::VT_AGE, false)? .visit_field::<f64>("age", Self::VT_AGE, false)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<Galaxy>>>>("galaxies", Self::VT_GALAXIES, false)? .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<Galaxy>>>>("galaxies", Self::VT_GALAXIES, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
}
pub struct UniverseArgs<'a> {
pub age: f64,
pub galaxies: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Galaxy<'a>>>>>,
}
impl<'a> Default for UniverseArgs<'a> {
#[inline]
fn default() -> Self {
UniverseArgs {
age: 0.0,
galaxies: None,
} }
}
}
pub struct UniverseBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { pub struct UniverseArgs<'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, pub age: f64,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, pub galaxies: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Galaxy<'a>>>>>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> UniverseBuilder<'a, 'b, A> {
#[inline]
pub fn add_age(&mut self, age: f64) {
self.fbb_.push_slot::<f64>(Universe::VT_AGE, age, 0.0);
}
#[inline]
pub fn add_galaxies(&mut self, galaxies: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Galaxy<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Universe::VT_GALAXIES, galaxies);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> UniverseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
UniverseBuilder {
fbb_: _fbb,
start_: start,
} }
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Universe<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Universe<'_> { impl<'a> Default for UniverseArgs<'a> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { #[inline]
let mut ds = f.debug_struct("Universe"); fn default() -> Self {
ds.field("age", &self.age()); UniverseArgs {
ds.field("galaxies", &self.galaxies()); age: 0.0,
ds.finish() galaxies: None,
} }
} }
#[inline] }
/// Verifies that a buffer of bytes contains a `Universe`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_universe_unchecked`.
pub fn root_as_universe(buf: &[u8]) -> Result<Universe<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<Universe>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `Universe` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_universe_unchecked`.
pub fn size_prefixed_root_as_universe(buf: &[u8]) -> Result<Universe<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<Universe>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `Universe` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_universe_unchecked`.
pub fn root_as_universe_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Universe<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<Universe<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Universe` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_universe_unchecked`.
pub fn size_prefixed_root_as_universe_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Universe<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<Universe<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Universe and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Universe`.
pub unsafe fn root_as_universe_unchecked(buf: &[u8]) -> Universe<'_> {
unsafe { ::flatbuffers::root_unchecked::<Universe>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Universe and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Universe`.
pub unsafe fn size_prefixed_root_as_universe_unchecked(buf: &[u8]) -> Universe<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Universe>(buf) }
}
#[inline]
pub fn finish_universe_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<Universe<'a>>) {
fbb.finish(root, None);
}
#[inline] pub struct UniverseBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
pub fn finish_size_prefixed_universe_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<Universe<'a>>) { fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
fbb.finish_size_prefixed(root, None); start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
} // pub mod goldens
} // pub mod flatbuffers
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> UniverseBuilder<'a, 'b, A> {
#[inline]
pub fn add_age(&mut self, age: f64) {
self.fbb_.push_slot::<f64>(Universe::VT_AGE, age, 0.0);
}
#[inline]
pub fn add_galaxies(&mut self, galaxies: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Galaxy<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Universe::VT_GALAXIES, galaxies);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> UniverseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
UniverseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Universe<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Universe<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Universe");
ds.field("age", &self.age());
ds.field("galaxies", &self.galaxies());
ds.finish()
}
}
/// Verifies that a buffer of bytes contains a `Universe`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_universe_unchecked`.
#[inline]
pub fn root_as_universe(buf: &[u8]) -> Result<Universe<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<Universe>(buf)
}
/// Verifies that a buffer of bytes contains a size prefixed
/// `Universe` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_universe_unchecked`.
#[inline]
pub fn size_prefixed_root_as_universe(buf: &[u8]) -> Result<Universe<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<Universe>(buf)
}
/// Verifies, with the given options, that a buffer of bytes
/// contains a `Universe` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_universe_unchecked`.
#[inline]
pub fn root_as_universe_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Universe<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<Universe<'b>>(opts, buf)
}
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Universe` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_universe_unchecked`.
#[inline]
pub fn size_prefixed_root_as_universe_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Universe<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<Universe<'b>>(opts, buf)
}
/// Assumes, without verification, that a buffer of bytes contains a Universe and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Universe`.
#[inline]
pub unsafe fn root_as_universe_unchecked(buf: &[u8]) -> Universe<'_> {
unsafe { ::flatbuffers::root_unchecked::<Universe>(buf) }
}
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Universe and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Universe`.
#[inline]
pub unsafe fn size_prefixed_root_as_universe_unchecked(buf: &[u8]) -> Universe<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Universe>(buf) }
}
#[inline]
pub fn finish_universe_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<Universe<'a>>) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_universe_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<Universe<'a>>) {
fbb.finish_size_prefixed(root, None);
}
} // pub mod goldens
} // pub mod flatbuffers

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_COLOR: i8 = 0; pub const ENUM_MIN_COLOR: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_COLOR: i8 = 2; pub const ENUM_MAX_COLOR: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_COLOR: [Color; 3] = [ pub const ENUM_VALUES_COLOR: [Color; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_COLOR: [Color; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct Color(pub i8); pub struct Color(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Color { impl Color {
pub const Red: Self = Self(0); pub const Red: Self = Self(0);
@@ -30,6 +34,7 @@ impl Color {
Self::Green, Self::Green,
Self::Blue, Self::Blue,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl Color {
} }
} }
} }
impl ::core::fmt::Debug for Color { impl ::core::fmt::Debug for Color {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for Color {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for Color { impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Color {
impl ::flatbuffers::Push for Color { impl ::flatbuffers::Push for Color {
type Output = Color; type Output = Color;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for Color {
impl ::flatbuffers::EndianScalar for Color { impl ::flatbuffers::EndianScalar for Color {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_EQUIPMENT: u8 = 0; pub const ENUM_MIN_EQUIPMENT: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_EQUIPMENT: u8 = 1; pub const ENUM_MAX_EQUIPMENT: u8 = 1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_EQUIPMENT: [Equipment; 2] = [ pub const ENUM_VALUES_EQUIPMENT: [Equipment; 2] = [
@@ -16,6 +19,7 @@ pub const ENUM_VALUES_EQUIPMENT: [Equipment; 2] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct Equipment(pub u8); pub struct Equipment(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Equipment { impl Equipment {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -27,6 +31,7 @@ impl Equipment {
Self::NONE, Self::NONE,
Self::Weapon, Self::Weapon,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -36,6 +41,7 @@ impl Equipment {
} }
} }
} }
impl ::core::fmt::Debug for Equipment { impl ::core::fmt::Debug for Equipment {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -45,8 +51,10 @@ impl ::core::fmt::Debug for Equipment {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for Equipment { impl<'a> ::flatbuffers::Follow<'a> for Equipment {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -56,6 +64,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Equipment {
impl ::flatbuffers::Push for Equipment { impl ::flatbuffers::Push for Equipment {
type Output = Equipment; type Output = Equipment;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -64,10 +73,12 @@ impl ::flatbuffers::Push for Equipment {
impl ::flatbuffers::EndianScalar for Equipment { impl ::flatbuffers::EndianScalar for Equipment {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -86,6 +97,7 @@ impl<'a> ::flatbuffers::Verifiable for Equipment {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Equipment {} impl ::flatbuffers::SimpleToVerifyInSlice for Equipment {}
pub struct EquipmentUnionTableOffset {} pub struct EquipmentUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -95,11 +107,13 @@ pub enum EquipmentT {
NONE, NONE,
Weapon(alloc::boxed::Box<WeaponT>), Weapon(alloc::boxed::Box<WeaponT>),
} }
impl Default for EquipmentT { impl Default for EquipmentT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl EquipmentT { impl EquipmentT {
pub fn equipment_type(&self) -> Equipment { pub fn equipment_type(&self) -> Equipment {
match self { match self {
@@ -107,12 +121,14 @@ impl EquipmentT {
Self::Weapon(_) => Equipment::Weapon, Self::Weapon(_) => Equipment::Weapon,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::Weapon(v) => Some(v.pack(fbb).as_union_value()), Self::Weapon(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned WeaponT, setting the union to NONE. /// If the union variant matches, return the owned WeaponT, setting the union to NONE.
pub fn take_weapon(&mut self) -> Option<alloc::boxed::Box<WeaponT>> { pub fn take_weapon(&mut self) -> Option<alloc::boxed::Box<WeaponT>> {
if let Self::Weapon(_) = self { if let Self::Weapon(_) = self {
@@ -126,12 +142,15 @@ impl EquipmentT {
None None
} }
} }
/// If the union variant matches, return a reference to the WeaponT. /// If the union variant matches, return a reference to the WeaponT.
pub fn as_weapon(&self) -> Option<&WeaponT> { pub fn as_weapon(&self) -> Option<&WeaponT> {
if let Self::Weapon(v) = self { Some(v.as_ref()) } else { None } if let Self::Weapon(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the WeaponT. /// If the union variant matches, return a mutable reference to the WeaponT.
pub fn as_weapon_mut(&mut self) -> Option<&mut WeaponT> { pub fn as_weapon_mut(&mut self) -> Option<&mut WeaponT> {
if let Self::Weapon(v) = self { Some(v.as_mut()) } else { None } if let Self::Weapon(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -37,6 +39,7 @@ impl<'a> Monster<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -104,6 +107,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Vec3>(Monster::VT_POS, None)} unsafe { self._tab.get::<Vec3>(Monster::VT_POS, None)}
} }
#[inline] #[inline]
pub fn mana(&self) -> i16 { pub fn mana(&self) -> i16 {
// Safety: // Safety:
@@ -111,6 +115,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()} unsafe { self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()}
} }
#[inline] #[inline]
pub fn hp(&self) -> i16 { pub fn hp(&self) -> i16 {
// Safety: // Safety:
@@ -118,6 +123,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()} unsafe { self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()}
} }
#[inline] #[inline]
pub fn name(&self) -> Option<&'a str> { pub fn name(&self) -> Option<&'a str> {
// Safety: // Safety:
@@ -125,6 +131,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None)}
} }
#[inline] #[inline]
pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> { pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety: // Safety:
@@ -132,6 +139,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)}
} }
#[inline] #[inline]
pub fn color(&self) -> Color { pub fn color(&self) -> Color {
// Safety: // Safety:
@@ -139,6 +147,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()} unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()}
} }
#[inline] #[inline]
pub fn weapons(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon<'a>>>> { pub fn weapons(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon<'a>>>> {
// Safety: // Safety:
@@ -146,6 +155,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon>>>>(Monster::VT_WEAPONS, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Weapon>>>>(Monster::VT_WEAPONS, None)}
} }
#[inline] #[inline]
pub fn equipped_type(&self) -> Equipment { pub fn equipped_type(&self) -> Equipment {
// Safety: // Safety:
@@ -153,6 +163,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Equipment>(Monster::VT_EQUIPPED_TYPE, Some(Equipment::NONE)).unwrap()} unsafe { self._tab.get::<Equipment>(Monster::VT_EQUIPPED_TYPE, Some(Equipment::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn equipped(&self) -> Option<::flatbuffers::Table<'a>> { pub fn equipped(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -160,6 +171,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_EQUIPPED, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_EQUIPPED, None)}
} }
#[inline] #[inline]
pub fn path(&self) -> Option<::flatbuffers::Vector<'a, Vec3>> { pub fn path(&self) -> Option<::flatbuffers::Vector<'a, Vec3>> {
// Safety: // Safety:
@@ -167,6 +179,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Vec3>>>(Monster::VT_PATH, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Vec3>>>(Monster::VT_PATH, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn equipped_as_weapon(&self) -> Option<Weapon<'a>> { pub fn equipped_as_weapon(&self) -> Option<Weapon<'a>> {
@@ -181,7 +194,6 @@ impl<'a> Monster<'a> {
None None
} }
} }
} }
impl ::flatbuffers::Verifiable for Monster<'_> { impl ::flatbuffers::Verifiable for Monster<'_> {
@@ -208,6 +220,7 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
Ok(()) Ok(())
} }
} }
pub struct MonsterArgs<'a> { pub struct MonsterArgs<'a> {
pub pos: Option<&'a Vec3>, pub pos: Option<&'a Vec3>,
pub mana: i16, pub mana: i16,
@@ -220,6 +233,7 @@ pub struct MonsterArgs<'a> {
pub equipped: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>, pub equipped: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
pub path: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, Vec3>>>, pub path: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, Vec3>>>,
} }
impl<'a> Default for MonsterArgs<'a> { impl<'a> Default for MonsterArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -242,47 +256,58 @@ pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_pos(&mut self, pos: &Vec3) { pub fn add_pos(&mut self, pos: &Vec3) {
self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos); self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
} }
#[inline] #[inline]
pub fn add_mana(&mut self, mana: i16) { pub fn add_mana(&mut self, mana: i16) {
self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150); self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150);
} }
#[inline] #[inline]
pub fn add_hp(&mut self, hp: i16) { pub fn add_hp(&mut self, hp: i16) {
self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100); self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
} }
#[inline] #[inline]
pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
} }
#[inline] #[inline]
pub fn add_inventory(&mut self, inventory: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) { pub fn add_inventory(&mut self, inventory: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
} }
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue); self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
} }
#[inline] #[inline]
pub fn add_weapons(&mut self, weapons: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Weapon<'b >>>>) { pub fn add_weapons(&mut self, weapons: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Weapon<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_WEAPONS, weapons); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_WEAPONS, weapons);
} }
#[inline] #[inline]
pub fn add_equipped_type(&mut self, equipped_type: Equipment) { pub fn add_equipped_type(&mut self, equipped_type: Equipment) {
self.fbb_.push_slot::<Equipment>(Monster::VT_EQUIPPED_TYPE, equipped_type, Equipment::NONE); self.fbb_.push_slot::<Equipment>(Monster::VT_EQUIPPED_TYPE, equipped_type, Equipment::NONE);
} }
#[inline] #[inline]
pub fn add_equipped(&mut self, equipped: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_equipped(&mut self, equipped: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_EQUIPPED, equipped); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_EQUIPPED, equipped);
} }
#[inline] #[inline]
pub fn add_path(&mut self, path: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Vec3>>) { pub fn add_path(&mut self, path: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Vec3>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_PATH, path); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_PATH, path);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -291,6 +316,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -326,6 +352,7 @@ impl ::core::fmt::Debug for Monster<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct MonsterT { pub struct MonsterT {
@@ -339,6 +366,7 @@ pub struct MonsterT {
pub equipped: EquipmentT, pub equipped: EquipmentT,
pub path: Option<alloc::vec::Vec<Vec3T>>, pub path: Option<alloc::vec::Vec<Vec3T>>,
} }
impl Default for MonsterT { impl Default for MonsterT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -354,6 +382,7 @@ impl Default for MonsterT {
} }
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
@@ -392,66 +421,73 @@ impl MonsterT {
}) })
} }
} }
#[inline]
/// Verifies that a buffer of bytes contains a `Monster` /// Verifies that a buffer of bytes contains a `Monster`
/// and returns it. /// and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
#[inline]
pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<Monster>(buf) ::flatbuffers::root::<Monster>(buf)
} }
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
/// `Monster` and returns it. /// `Monster` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_monster_unchecked`. /// `size_prefixed_root_as_monster_unchecked`.
#[inline]
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<Monster>(buf) ::flatbuffers::size_prefixed_root::<Monster>(buf)
} }
#[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
/// contains a `Monster` and returns it. /// contains a `Monster` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
#[inline]
pub fn root_as_monster_with_opts<'b, 'o>( pub fn root_as_monster_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<Monster<'b>>(opts, buf) ::flatbuffers::root_with_opts::<Monster<'b>>(opts, buf)
} }
#[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Monster` and returns /// bytes contains a size prefixed `Monster` and returns
/// it. Note that verification is still experimental and may not /// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
#[inline]
pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>( pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf)
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Monster and returns it. /// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Monster`. /// Callers must trust the given bytes do indeed contain a valid `Monster`.
#[inline]
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> { pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { ::flatbuffers::root_unchecked::<Monster>(buf) } unsafe { ::flatbuffers::root_unchecked::<Monster>(buf) }
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
#[inline]
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> { pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) }
} }
#[inline] #[inline]
pub fn finish_monster_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>( pub fn finish_monster_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Vec3, aligned to 4 // struct Vec3, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Vec3(pub [u8; 12]); pub struct Vec3(pub [u8; 12]);
impl Default for Vec3 { impl Default for Vec3 {
fn default() -> Self { fn default() -> Self {
Self([0; 12]) Self([0; 12])
} }
} }
impl ::core::fmt::Debug for Vec3 { impl ::core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Vec3") f.debug_struct("Vec3")
@@ -22,27 +25,34 @@ impl ::core::fmt::Debug for Vec3 {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {} impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {}
impl<'a> ::flatbuffers::Follow<'a> for Vec3 { impl<'a> ::flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Vec3>::follow(buf, loc) } unsafe { <&'a Vec3>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 { impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Vec3 { impl<'b> ::flatbuffers::Push for Vec3 {
type Output = Vec3; type Output = Vec3;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -178,6 +188,7 @@ pub struct Vec3T {
pub y: f32, pub y: f32,
pub z: f32, pub z: f32,
} }
impl Vec3T { impl Vec3T {
pub fn pack(&self) -> Vec3 { pub fn pack(&self) -> Vec3 {
Vec3::new( Vec3::new(
@@ -187,4 +198,3 @@ impl Vec3T {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum WeaponOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum WeaponOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Weapon<'a> { pub struct Weapon<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Weapon<'a> { impl<'a> ::flatbuffers::Follow<'a> for Weapon<'a> {
type Inner = Weapon<'a>; type Inner = Weapon<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +31,7 @@ impl<'a> Weapon<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Weapon { _tab: table } Weapon { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -58,6 +61,7 @@ impl<'a> Weapon<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Weapon::VT_NAME, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Weapon::VT_NAME, None)}
} }
#[inline] #[inline]
pub fn damage(&self) -> i16 { pub fn damage(&self) -> i16 {
// Safety: // Safety:
@@ -79,10 +83,12 @@ impl ::flatbuffers::Verifiable for Weapon<'_> {
Ok(()) Ok(())
} }
} }
pub struct WeaponArgs<'a> { pub struct WeaponArgs<'a> {
pub name: Option<::flatbuffers::WIPOffset<&'a str>>, pub name: Option<::flatbuffers::WIPOffset<&'a str>>,
pub damage: i16, pub damage: i16,
} }
impl<'a> Default for WeaponArgs<'a> { impl<'a> Default for WeaponArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -97,15 +103,18 @@ pub struct WeaponBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> WeaponBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> WeaponBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Weapon::VT_NAME, name); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Weapon::VT_NAME, name);
} }
#[inline] #[inline]
pub fn add_damage(&mut self, damage: i16) { pub fn add_damage(&mut self, damage: i16) {
self.fbb_.push_slot::<i16>(Weapon::VT_DAMAGE, damage, 0); self.fbb_.push_slot::<i16>(Weapon::VT_DAMAGE, damage, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -114,6 +123,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> WeaponBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Weapon<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Weapon<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -129,12 +139,14 @@ impl ::core::fmt::Debug for Weapon<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct WeaponT { pub struct WeaponT {
pub name: Option<alloc::string::String>, pub name: Option<alloc::string::String>,
pub damage: i16, pub damage: i16,
} }
impl Default for WeaponT { impl Default for WeaponT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -143,6 +155,7 @@ impl Default for WeaponT {
} }
} }
} }
impl WeaponT { impl WeaponT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -429,8 +429,7 @@ class RustGenerator : public BaseGenerator {
// Generate imports for the global scope in case no namespace is used // Generate imports for the global scope in case no namespace is used
// in the schema file. // in the schema file.
GenNamespaceImports(0); GenNamespaceImports();
code_ += "";
// Generate all code in their namespaces, once, because Rust does not // Generate all code in their namespaces, once, because Rust does not
// permit re-opening modules. // permit re-opening modules.
@@ -708,6 +707,8 @@ class RustGenerator : public BaseGenerator {
// an enum match function, // an enum match function,
// and an enum array of values // and an enum array of values
void GenEnum(const EnumDef& enum_def) { void GenEnum(const EnumDef& enum_def) {
code_ += "";
const bool is_private = parser_.opts.no_leak_private_annotations && const bool is_private = parser_.opts.no_leak_private_annotations &&
(enum_def.attributes.Lookup("private") != nullptr); (enum_def.attributes.Lookup("private") != nullptr);
code_.SetValue("ACCESS_TYPE", is_private ? "pub(crate)" : "pub"); code_.SetValue("ACCESS_TYPE", is_private ? "pub(crate)" : "pub");
@@ -739,6 +740,8 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
code_ += "pub use self::bitflags_{{ENUM_NAMESPACE}}::{{ENUM_TY}};"; code_ += "pub use self::bitflags_{{ENUM_NAMESPACE}}::{{ENUM_TY}};";
code_ += ""; code_ += "";
@@ -753,10 +756,14 @@ class RustGenerator : public BaseGenerator {
code_ += code_ +=
"pub const ENUM_MIN_{{ENUM_CONSTANT}}: {{BASE_TYPE}}" "pub const ENUM_MIN_{{ENUM_CONSTANT}}: {{BASE_TYPE}}"
" = {{ENUM_MIN_BASE_VALUE}};"; " = {{ENUM_MIN_BASE_VALUE}};";
code_ += "";
code_ += deprecation_warning; code_ += deprecation_warning;
code_ += code_ +=
"pub const ENUM_MAX_{{ENUM_CONSTANT}}: {{BASE_TYPE}}" "pub const ENUM_MAX_{{ENUM_CONSTANT}}: {{BASE_TYPE}}"
" = {{ENUM_MAX_BASE_VALUE}};"; " = {{ENUM_MAX_BASE_VALUE}};";
code_ += "";
auto num_fields = NumToString(enum_def.size()); auto num_fields = NumToString(enum_def.size());
code_ += deprecation_warning; code_ += deprecation_warning;
code_ += "#[allow(non_camel_case_types)]"; code_ += "#[allow(non_camel_case_types)]";
@@ -777,6 +784,8 @@ class RustGenerator : public BaseGenerator {
"Default)]"; "Default)]";
code_ += "#[repr(transparent)]"; code_ += "#[repr(transparent)]";
code_ += "{{ACCESS_TYPE}} struct {{ENUM_TY}}(pub {{BASE_TYPE}});"; code_ += "{{ACCESS_TYPE}} struct {{ENUM_TY}}(pub {{BASE_TYPE}});";
code_ += "";
code_ += "#[allow(non_upper_case_globals)]"; code_ += "#[allow(non_upper_case_globals)]";
code_ += "impl {{ENUM_TY}} {"; code_ += "impl {{ENUM_TY}} {";
ForAllEnumValues1(enum_def, [&](const EnumVal& ev) { ForAllEnumValues1(enum_def, [&](const EnumVal& ev) {
@@ -790,6 +799,8 @@ class RustGenerator : public BaseGenerator {
code_ += " pub const ENUM_VALUES: &'static [Self] = &["; code_ += " pub const ENUM_VALUES: &'static [Self] = &[";
ForAllEnumValues(enum_def, [&]() { code_ += " Self::{{VARIANT}},"; }); ForAllEnumValues(enum_def, [&]() { code_ += " Self::{{VARIANT}},"; });
code_ += " ];"; code_ += " ];";
code_ += "";
code_ += " /// Returns the variant's name or \"\" if unknown."; code_ += " /// Returns the variant's name or \"\" if unknown.";
code_ += " pub fn variant_name(self) -> Option<&'static str> {"; code_ += " pub fn variant_name(self) -> Option<&'static str> {";
code_ += " match self {"; code_ += " match self {";
@@ -800,6 +811,7 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
// Generate Debug. Unknown variants are printed like "<UNKNOWN 42>". // Generate Debug. Unknown variants are printed like "<UNKNOWN 42>".
code_ += "impl ::core::fmt::Debug for {{ENUM_TY}} {"; code_ += "impl ::core::fmt::Debug for {{ENUM_TY}} {";
@@ -813,6 +825,7 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
code_.SetValue("INTO_BASE", "self.0"); code_.SetValue("INTO_BASE", "self.0");
} }
@@ -864,6 +877,7 @@ class RustGenerator : public BaseGenerator {
// Generate Follow and Push so we can serialize and stuff. // Generate Follow and Push so we can serialize and stuff.
code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{ENUM_TY}} {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{ENUM_TY}} {";
code_ += " type Inner = Self;"; code_ += " type Inner = Self;";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += code_ +=
@@ -879,6 +893,7 @@ class RustGenerator : public BaseGenerator {
code_ += ""; code_ += "";
code_ += "impl ::flatbuffers::Push for {{ENUM_TY}} {"; code_ += "impl ::flatbuffers::Push for {{ENUM_TY}} {";
code_ += " type Output = {{ENUM_TY}};"; code_ += " type Output = {{ENUM_TY}};";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {"; code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {";
code_ += code_ +=
@@ -889,10 +904,12 @@ class RustGenerator : public BaseGenerator {
code_ += ""; code_ += "";
code_ += "impl ::flatbuffers::EndianScalar for {{ENUM_TY}} {"; code_ += "impl ::flatbuffers::EndianScalar for {{ENUM_TY}} {";
code_ += " type Scalar = {{BASE_TYPE}};"; code_ += " type Scalar = {{BASE_TYPE}};";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn to_little_endian(self) -> {{BASE_TYPE}} {"; code_ += " fn to_little_endian(self) -> {{BASE_TYPE}} {";
code_ += " {{INTO_BASE}}.to_le()"; code_ += " {{INTO_BASE}}.to_le()";
code_ += " }"; code_ += " }";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " #[allow(clippy::wrong_self_convention)]"; code_ += " #[allow(clippy::wrong_self_convention)]";
code_ += " fn from_little_endian(v: {{BASE_TYPE}}) -> Self {"; code_ += " fn from_little_endian(v: {{BASE_TYPE}}) -> Self {";
@@ -922,8 +939,8 @@ class RustGenerator : public BaseGenerator {
if (enum_def.is_union) { if (enum_def.is_union) {
// Generate typesafe offset(s) for unions // Generate typesafe offset(s) for unions
code_.SetValue("UNION_TYPE", namer_.Type(enum_def)); code_.SetValue("UNION_TYPE", namer_.Type(enum_def));
code_ += "{{ACCESS_TYPE}} struct {{UNION_TYPE}}UnionTableOffset {}";
code_ += ""; code_ += "";
code_ += "{{ACCESS_TYPE}} struct {{UNION_TYPE}}UnionTableOffset {}";
if (parser_.opts.generate_object_based_api) { if (parser_.opts.generate_object_based_api) {
GenUnionObject(enum_def); GenUnionObject(enum_def);
} }
@@ -955,6 +972,7 @@ class RustGenerator : public BaseGenerator {
code_.SetValue("ENUM_OTY", namer_.ObjectType(enum_def)); code_.SetValue("ENUM_OTY", namer_.ObjectType(enum_def));
// Generate native union. // Generate native union.
code_ += "";
code_ += "#[allow(clippy::upper_case_acronyms)]"; // NONE's spelling is code_ += "#[allow(clippy::upper_case_acronyms)]"; // NONE's spelling is
// intended. // intended.
code_ += "#[non_exhaustive]"; code_ += "#[non_exhaustive]";
@@ -966,12 +984,15 @@ class RustGenerator : public BaseGenerator {
"{{NATIVE_VARIANT}}(alloc::boxed::Box<{{U_ELEMENT_TABLE_TYPE}}>),"; "{{NATIVE_VARIANT}}(alloc::boxed::Box<{{U_ELEMENT_TABLE_TYPE}}>),";
}); });
code_ += "}"; code_ += "}";
code_ += "";
// Generate Default (NONE). // Generate Default (NONE).
code_ += "impl Default for {{ENUM_OTY}} {"; code_ += "impl Default for {{ENUM_OTY}} {";
code_ += " fn default() -> Self {"; code_ += " fn default() -> Self {";
code_ += " Self::NONE"; code_ += " Self::NONE";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
// Generate native union methods. // Generate native union methods.
code_ += "impl {{ENUM_OTY}} {"; code_ += "impl {{ENUM_OTY}} {";
@@ -988,6 +1009,8 @@ class RustGenerator : public BaseGenerator {
}); });
code_ += " }"; code_ += " }";
code_ += " }"; code_ += " }";
code_ += "";
// Pack flatbuffers union value // Pack flatbuffers union value
code_ += code_ +=
" pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut " " pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut "
@@ -1006,6 +1029,7 @@ class RustGenerator : public BaseGenerator {
// Generate some accessors; // Generate some accessors;
ForAllUnionObjectVariantsBesidesNone(enum_def, [&] { ForAllUnionObjectVariantsBesidesNone(enum_def, [&] {
// Move accessor. // Move accessor.
code_ += "";
code_ += code_ +=
"/// If the union variant matches, return the owned " "/// If the union variant matches, return the owned "
"{{U_ELEMENT_TABLE_TYPE}}, setting the union to NONE."; "{{U_ELEMENT_TABLE_TYPE}}, setting the union to NONE.";
@@ -1023,7 +1047,9 @@ class RustGenerator : public BaseGenerator {
code_ += " None"; code_ += " None";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
// Immutable reference accessor. // Immutable reference accessor.
code_ += "";
code_ += code_ +=
"/// If the union variant matches, return a reference to the " "/// If the union variant matches, return a reference to the "
"{{U_ELEMENT_TABLE_TYPE}}."; "{{U_ELEMENT_TABLE_TYPE}}.";
@@ -1034,7 +1060,9 @@ class RustGenerator : public BaseGenerator {
" if let Self::{{NATIVE_VARIANT}}(v) = self " " if let Self::{{NATIVE_VARIANT}}(v) = self "
"{ Some(v.as_ref()) } else { None }"; "{ Some(v.as_ref()) } else { None }";
code_ += "}"; code_ += "}";
// Mutable reference accessor. // Mutable reference accessor.
code_ += "";
code_ += code_ +=
"/// If the union variant matches, return a mutable reference" "/// If the union variant matches, return a mutable reference"
" to the {{U_ELEMENT_TABLE_TYPE}}."; " to the {{U_ELEMENT_TABLE_TYPE}}.";
@@ -1046,7 +1074,9 @@ class RustGenerator : public BaseGenerator {
"{ Some(v.as_mut()) } else { None }"; "{ Some(v.as_mut()) } else { None }";
code_ += "}"; code_ += "}";
}); });
code_ += "}"; // End union methods impl. code_ += "}"; // End union methods impl.
code_ += "";
} }
enum DefaultContext { kBuilder, kAccessor, kObject }; enum DefaultContext { kBuilder, kAccessor, kObject };
@@ -1673,6 +1703,8 @@ class RustGenerator : public BaseGenerator {
// Generate an accessor struct, builder struct, and create function for a // Generate an accessor struct, builder struct, and create function for a
// table. // table.
void GenTable(const StructDef& struct_def) { void GenTable(const StructDef& struct_def) {
code_ += "";
const bool is_private = const bool is_private =
parser_.opts.no_leak_private_annotations && parser_.opts.no_leak_private_annotations &&
(struct_def.attributes.Lookup("private") != nullptr); (struct_def.attributes.Lookup("private") != nullptr);
@@ -1683,17 +1715,18 @@ class RustGenerator : public BaseGenerator {
// Generate an offset type, the base type, the Follow impl, and the // Generate an offset type, the base type, the Follow impl, and the
// init_from_table impl. // init_from_table impl.
code_ += "{{ACCESS_TYPE}} enum {{STRUCT_TY}}Offset {}"; code_ += "{{ACCESS_TYPE}} enum {{STRUCT_TY}}Offset {}";
code_ += "#[derive(Copy, Clone, PartialEq)]";
code_ += ""; code_ += "";
GenComment(struct_def.doc_comment); GenComment(struct_def.doc_comment);
code_ += "#[derive(Copy, Clone, PartialEq)]";
code_ += "{{ACCESS_TYPE}} struct {{STRUCT_TY}}<'a> {"; code_ += "{{ACCESS_TYPE}} struct {{STRUCT_TY}}<'a> {";
code_ += " pub _tab: ::flatbuffers::Table<'a>,"; code_ += " pub _tab: ::flatbuffers::Table<'a>,";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{STRUCT_TY}}<'a> {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{STRUCT_TY}}<'a> {";
code_ += " type Inner = {{STRUCT_TY}}<'a>;"; code_ += " type Inner = {{STRUCT_TY}}<'a>;";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += code_ +=
@@ -1710,7 +1743,8 @@ class RustGenerator : public BaseGenerator {
"pub const {{OFFSET_NAME}}: ::flatbuffers::VOffsetT = " "pub const {{OFFSET_NAME}}: ::flatbuffers::VOffsetT = "
"{{OFFSET_VALUE}};"; "{{OFFSET_VALUE}};";
}); });
code_ += "";
if (struct_def.fields.vec.size() > 0) { code_ += ""; }
if (parser_.opts.generate_name_strings) { if (parser_.opts.generate_name_strings) {
GenFullyQualifiedNameGetter(struct_def, struct_def.name); GenFullyQualifiedNameGetter(struct_def, struct_def.name);
@@ -1722,6 +1756,7 @@ class RustGenerator : public BaseGenerator {
"Self {"; "Self {";
code_ += " {{STRUCT_TY}} { _tab: table }"; code_ += " {{STRUCT_TY}} { _tab: table }";
code_ += " }"; code_ += " }";
code_ += "";
// Generate a convenient create* function that uses the above builder // Generate a convenient create* function that uses the above builder
// to create a table in one function call. // to create a table in one function call.
@@ -1759,6 +1794,7 @@ class RustGenerator : public BaseGenerator {
code_ += " builder.finish()"; code_ += " builder.finish()";
code_ += " }"; code_ += " }";
code_ += ""; code_ += "";
// Generate Object API Packer function. // Generate Object API Packer function.
if (parser_.opts.generate_object_based_api) { if (parser_.opts.generate_object_based_api) {
// TODO(cneo): Replace more for loops with ForAllX stuff. // TODO(cneo): Replace more for loops with ForAllX stuff.
@@ -1858,6 +1894,7 @@ class RustGenerator : public BaseGenerator {
code_ += " };"; code_ += " };";
} }
}); });
code_ += " {{STRUCT_OTY}} {"; code_ += " {{STRUCT_OTY}} {";
ForAllObjectTableFields(struct_def, [&](const FieldDef& field) { ForAllObjectTableFields(struct_def, [&](const FieldDef& field) {
if (field.value.type.base_type == BASE_TYPE_UTYPE) return; if (field.value.type.base_type == BASE_TYPE_UTYPE) return;
@@ -1867,8 +1904,6 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
} }
if (struct_def.fields.vec.size() > 0) code_ += "";
// Generate the accessors. Each has one of two forms: // Generate the accessors. Each has one of two forms:
// //
// If a value can be None: // If a value can be None:
@@ -1881,6 +1916,7 @@ class RustGenerator : public BaseGenerator {
// self._tab.get::<internal_type>(offset, defaultval).unwrap() // self._tab.get::<internal_type>(offset, defaultval).unwrap()
// } // }
ForAllTableFields(struct_def, [&](const FieldDef& field) { ForAllTableFields(struct_def, [&](const FieldDef& field) {
code_ += "";
code_.SetValue("RETURN_TYPE", code_.SetValue("RETURN_TYPE",
GenTableAccessorFuncReturnType(field, "'a")); GenTableAccessorFuncReturnType(field, "'a"));
@@ -1911,6 +1947,7 @@ class RustGenerator : public BaseGenerator {
FLATBUFFERS_ASSERT(nested_root); // Guaranteed to exist by parser. FLATBUFFERS_ASSERT(nested_root); // Guaranteed to exist by parser.
code_.SetValue("NESTED", WrapInNameSpace(*nested_root)); code_.SetValue("NESTED", WrapInNameSpace(*nested_root));
code_ += "";
code_ += "pub fn {{FIELD}}_nested_flatbuffer(&'a self) -> \\"; code_ += "pub fn {{FIELD}}_nested_flatbuffer(&'a self) -> \\";
if (field.IsRequired()) { if (field.IsRequired()) {
code_ += "{{NESTED}}<'a> {"; code_ += "{{NESTED}}<'a> {";
@@ -1944,6 +1981,7 @@ class RustGenerator : public BaseGenerator {
ForAllUnionVariantsBesidesNone( ForAllUnionVariantsBesidesNone(
*field.value.type.enum_def, [&](const EnumVal& unused) { *field.value.type.enum_def, [&](const EnumVal& unused) {
(void)unused; (void)unused;
code_ += "";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += "#[allow(non_snake_case)]"; code_ += "#[allow(non_snake_case)]";
code_ += code_ +=
@@ -1987,7 +2025,6 @@ class RustGenerator : public BaseGenerator {
code_ += " None"; code_ += " None";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
}); });
}); });
code_ += "}"; // End of table impl. code_ += "}"; // End of table impl.
@@ -2042,6 +2079,7 @@ class RustGenerator : public BaseGenerator {
code_ += " Ok(())"; code_ += " Ok(())";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
// Generate an args struct: // Generate an args struct:
code_.SetValue("MAYBE_LT", code_.SetValue("MAYBE_LT",
@@ -2052,6 +2090,7 @@ class RustGenerator : public BaseGenerator {
code_ += " pub {{FIELD}}: {{PARAM_TYPE}},"; code_ += " pub {{FIELD}}: {{PARAM_TYPE}},";
}); });
code_ += "}"; code_ += "}";
code_ += "";
// Generate an impl of Default for the *Args type: // Generate an impl of Default for the *Args type:
code_ += "impl<'a> Default for {{STRUCT_TY}}Args{{MAYBE_LT}} {"; code_ += "impl<'a> Default for {{STRUCT_TY}}Args{{MAYBE_LT}} {";
@@ -2145,6 +2184,7 @@ class RustGenerator : public BaseGenerator {
" start_: ::flatbuffers::WIPOffset<" " start_: ::flatbuffers::WIPOffset<"
"::flatbuffers::TableUnfinishedWIPOffset>,"; "::flatbuffers::TableUnfinishedWIPOffset>,";
code_ += "}"; code_ += "}";
code_ += "";
// Generate builder functions: // Generate builder functions:
code_ += code_ +=
@@ -2180,6 +2220,7 @@ class RustGenerator : public BaseGenerator {
code_ += " {{FUNC_BODY}}({{FIELD_OFFSET}}, {{FIELD}});"; code_ += " {{FUNC_BODY}}({{FIELD_OFFSET}}, {{FIELD}});";
} }
code_ += "}"; code_ += "}";
code_ += "";
}); });
// Struct initializer (all fields required); // Struct initializer (all fields required);
@@ -2195,6 +2236,7 @@ class RustGenerator : public BaseGenerator {
code_ += " start_: start,"; code_ += " start_: start,";
code_ += " }"; code_ += " }";
code_ += " }"; code_ += " }";
code_ += "";
// finish() function. // finish() function.
code_ += " #[inline]"; code_ += " #[inline]";
@@ -2258,6 +2300,8 @@ class RustGenerator : public BaseGenerator {
} }
void GenTableObject(const StructDef& table) { void GenTableObject(const StructDef& table) {
code_ += "";
code_.SetValue("STRUCT_OTY", namer_.ObjectType(table)); code_.SetValue("STRUCT_OTY", namer_.ObjectType(table));
code_.SetValue("STRUCT_TY", namer_.Type(table)); code_.SetValue("STRUCT_TY", namer_.Type(table));
@@ -2272,6 +2316,7 @@ class RustGenerator : public BaseGenerator {
code_ += "pub {{FIELD}}: {{FIELD_OTY}},"; code_ += "pub {{FIELD}}: {{FIELD_OTY}},";
}); });
code_ += "}"; code_ += "}";
code_ += "";
code_ += "impl Default for {{STRUCT_OTY}} {"; code_ += "impl Default for {{STRUCT_OTY}} {";
code_ += " fn default() -> Self {"; code_ += " fn default() -> Self {";
@@ -2284,6 +2329,7 @@ class RustGenerator : public BaseGenerator {
code_ += " }"; code_ += " }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
// TODO(cneo): Generate defaults for Native tables. However, since structs // TODO(cneo): Generate defaults for Native tables. However, since structs
// may be required, they, and therefore enums need defaults. // may be required, they, and therefore enums need defaults.
@@ -2430,6 +2476,8 @@ class RustGenerator : public BaseGenerator {
code_.SetValue("KEY_TYPE", GenTableAccessorFuncReturnType(field, "")); code_.SetValue("KEY_TYPE", GenTableAccessorFuncReturnType(field, ""));
code_.SetValue("REF", IsString(field.value.type) ? "" : "&"); code_.SetValue("REF", IsString(field.value.type) ? "" : "&");
code_ += "";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += code_ +=
"pub fn key_compare_less_than(&self, o: &{{STRUCT_TY}}) -> " "pub fn key_compare_less_than(&self, o: &{{STRUCT_TY}}) -> "
@@ -2437,6 +2485,7 @@ class RustGenerator : public BaseGenerator {
code_ += " self.{{FIELD}}() < o.{{FIELD}}()"; code_ += " self.{{FIELD}}() < o.{{FIELD}}()";
code_ += "}"; code_ += "}";
code_ += ""; code_ += "";
code_ += "#[inline]"; code_ += "#[inline]";
code_ += code_ +=
"pub fn key_compare_with_value(&self, val: {{KEY_TYPE}}) -> " "pub fn key_compare_with_value(&self, val: {{KEY_TYPE}}) -> "
@@ -2449,45 +2498,51 @@ class RustGenerator : public BaseGenerator {
// Generate functions for accessing the root table object. This function // Generate functions for accessing the root table object. This function
// must only be called if the root table is defined. // must only be called if the root table is defined.
void GenRootTableFuncs(const StructDef& struct_def) { void GenRootTableFuncs(const StructDef& struct_def) {
code_ += "";
FLATBUFFERS_ASSERT(parser_.root_struct_def_ && "root table not defined"); FLATBUFFERS_ASSERT(parser_.root_struct_def_ && "root table not defined");
code_.SetValue("STRUCT_TY", namer_.Type(struct_def)); code_.SetValue("STRUCT_TY", namer_.Type(struct_def));
code_.SetValue("STRUCT_FN", namer_.Function(struct_def)); code_.SetValue("STRUCT_FN", namer_.Function(struct_def));
code_.SetValue("STRUCT_CONST", namer_.Constant(struct_def.name)); code_.SetValue("STRUCT_CONST", namer_.Constant(struct_def.name));
// Default verifier root fns. // Default verifier root fns.
code_ += "#[inline]";
code_ += "/// Verifies that a buffer of bytes contains a `{{STRUCT_TY}}`"; code_ += "/// Verifies that a buffer of bytes contains a `{{STRUCT_TY}}`";
code_ += "/// and returns it."; code_ += "/// and returns it.";
code_ += "/// Note that verification is still experimental and may not"; code_ += "/// Note that verification is still experimental and may not";
code_ += "/// catch every error, or be maximally performant. For the"; code_ += "/// catch every error, or be maximally performant. For the";
code_ += "/// previous, unchecked, behavior use"; code_ += "/// previous, unchecked, behavior use";
code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`."; code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`.";
code_ += "#[inline]";
code_ += code_ +=
"pub fn root_as_{{STRUCT_FN}}(buf: &[u8]) " "pub fn root_as_{{STRUCT_FN}}(buf: &[u8]) "
"-> Result<{{STRUCT_TY}}<'_>, ::flatbuffers::InvalidFlatbuffer> {"; "-> Result<{{STRUCT_TY}}<'_>, ::flatbuffers::InvalidFlatbuffer> {";
code_ += " ::flatbuffers::root::<{{STRUCT_TY}}>(buf)"; code_ += " ::flatbuffers::root::<{{STRUCT_TY}}>(buf)";
code_ += "}"; code_ += "}";
code_ += "#[inline]"; code_ += "";
code_ += "/// Verifies that a buffer of bytes contains a size prefixed"; code_ += "/// Verifies that a buffer of bytes contains a size prefixed";
code_ += "/// `{{STRUCT_TY}}` and returns it."; code_ += "/// `{{STRUCT_TY}}` and returns it.";
code_ += "/// Note that verification is still experimental and may not"; code_ += "/// Note that verification is still experimental and may not";
code_ += "/// catch every error, or be maximally performant. For the"; code_ += "/// catch every error, or be maximally performant. For the";
code_ += "/// previous, unchecked, behavior use"; code_ += "/// previous, unchecked, behavior use";
code_ += "/// `size_prefixed_root_as_{{STRUCT_FN}}_unchecked`."; code_ += "/// `size_prefixed_root_as_{{STRUCT_FN}}_unchecked`.";
code_ += "#[inline]";
code_ += code_ +=
"pub fn size_prefixed_root_as_{{STRUCT_FN}}" "pub fn size_prefixed_root_as_{{STRUCT_FN}}"
"(buf: &[u8]) -> Result<{{STRUCT_TY}}<'_>, " "(buf: &[u8]) -> Result<{{STRUCT_TY}}<'_>, "
"::flatbuffers::InvalidFlatbuffer> {"; "::flatbuffers::InvalidFlatbuffer> {";
code_ += " ::flatbuffers::size_prefixed_root::<{{STRUCT_TY}}>(buf)"; code_ += " ::flatbuffers::size_prefixed_root::<{{STRUCT_TY}}>(buf)";
code_ += "}"; code_ += "}";
code_ += "";
// Verifier with options root fns. // Verifier with options root fns.
code_ += "#[inline]";
code_ += "/// Verifies, with the given options, that a buffer of bytes"; code_ += "/// Verifies, with the given options, that a buffer of bytes";
code_ += "/// contains a `{{STRUCT_TY}}` and returns it."; code_ += "/// contains a `{{STRUCT_TY}}` and returns it.";
code_ += "/// Note that verification is still experimental and may not"; code_ += "/// Note that verification is still experimental and may not";
code_ += "/// catch every error, or be maximally performant. For the"; code_ += "/// catch every error, or be maximally performant. For the";
code_ += "/// previous, unchecked, behavior use"; code_ += "/// previous, unchecked, behavior use";
code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`."; code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`.";
code_ += "#[inline]";
code_ += "pub fn root_as_{{STRUCT_FN}}_with_opts<'b, 'o>("; code_ += "pub fn root_as_{{STRUCT_FN}}_with_opts<'b, 'o>(";
code_ += " opts: &'o ::flatbuffers::VerifierOptions,"; code_ += " opts: &'o ::flatbuffers::VerifierOptions,";
code_ += " buf: &'b [u8],"; code_ += " buf: &'b [u8],";
@@ -2496,13 +2551,15 @@ class RustGenerator : public BaseGenerator {
" {"; " {";
code_ += " ::flatbuffers::root_with_opts::<{{STRUCT_TY}}<'b>>(opts, buf)"; code_ += " ::flatbuffers::root_with_opts::<{{STRUCT_TY}}<'b>>(opts, buf)";
code_ += "}"; code_ += "}";
code_ += "#[inline]"; code_ += "";
code_ += "/// Verifies, with the given verifier options, that a buffer of"; code_ += "/// Verifies, with the given verifier options, that a buffer of";
code_ += "/// bytes contains a size prefixed `{{STRUCT_TY}}` and returns"; code_ += "/// bytes contains a size prefixed `{{STRUCT_TY}}` and returns";
code_ += "/// it. Note that verification is still experimental and may not"; code_ += "/// it. Note that verification is still experimental and may not";
code_ += "/// catch every error, or be maximally performant. For the"; code_ += "/// catch every error, or be maximally performant. For the";
code_ += "/// previous, unchecked, behavior use"; code_ += "/// previous, unchecked, behavior use";
code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`."; code_ += "/// `root_as_{{STRUCT_FN}}_unchecked`.";
code_ += "#[inline]";
code_ += code_ +=
"pub fn size_prefixed_root_as_{{STRUCT_FN}}_with_opts" "pub fn size_prefixed_root_as_{{STRUCT_FN}}_with_opts"
"<'b, 'o>("; "<'b, 'o>(";
@@ -2515,8 +2572,9 @@ class RustGenerator : public BaseGenerator {
" ::flatbuffers::size_prefixed_root_with_opts::<{{STRUCT_TY}}" " ::flatbuffers::size_prefixed_root_with_opts::<{{STRUCT_TY}}"
"<'b>>(opts, buf)"; "<'b>>(opts, buf)";
code_ += "}"; code_ += "}";
code_ += "";
// Unchecked root fns. // Unchecked root fns.
code_ += "#[inline]";
code_ += code_ +=
"/// Assumes, without verification, that a buffer of bytes " "/// Assumes, without verification, that a buffer of bytes "
"contains a {{STRUCT_TY}} and returns it."; "contains a {{STRUCT_TY}} and returns it.";
@@ -2524,12 +2582,14 @@ class RustGenerator : public BaseGenerator {
code_ += code_ +=
"/// Callers must trust the given bytes do indeed contain a valid" "/// Callers must trust the given bytes do indeed contain a valid"
" `{{STRUCT_TY}}`."; " `{{STRUCT_TY}}`.";
code_ += "#[inline]";
code_ += code_ +=
"pub unsafe fn root_as_{{STRUCT_FN}}_unchecked" "pub unsafe fn root_as_{{STRUCT_FN}}_unchecked"
"(buf: &[u8]) -> {{STRUCT_TY}}<'_> {"; "(buf: &[u8]) -> {{STRUCT_TY}}<'_> {";
code_ += " unsafe { ::flatbuffers::root_unchecked::<{{STRUCT_TY}}>(buf) }"; code_ += " unsafe { ::flatbuffers::root_unchecked::<{{STRUCT_TY}}>(buf) }";
code_ += "}"; code_ += "}";
code_ += "#[inline]"; code_ += "";
code_ += code_ +=
"/// Assumes, without verification, that a buffer of bytes " "/// Assumes, without verification, that a buffer of bytes "
"contains a size prefixed {{STRUCT_TY}} and returns it."; "contains a size prefixed {{STRUCT_TY}} and returns it.";
@@ -2537,6 +2597,7 @@ class RustGenerator : public BaseGenerator {
code_ += code_ +=
"/// Callers must trust the given bytes do indeed contain a valid" "/// Callers must trust the given bytes do indeed contain a valid"
" size prefixed `{{STRUCT_TY}}`."; " size prefixed `{{STRUCT_TY}}`.";
code_ += "#[inline]";
code_ += code_ +=
"pub unsafe fn size_prefixed_root_as_{{STRUCT_FN}}" "pub unsafe fn size_prefixed_root_as_{{STRUCT_FN}}"
"_unchecked(buf: &[u8]) -> {{STRUCT_TY}}<'_> {"; "_unchecked(buf: &[u8]) -> {{STRUCT_TY}}<'_> {";
@@ -2545,6 +2606,7 @@ class RustGenerator : public BaseGenerator {
"::flatbuffers::size_prefixed_root_unchecked::<{{STRUCT_TY}}>" "::flatbuffers::size_prefixed_root_unchecked::<{{STRUCT_TY}}>"
"(buf) }"; "(buf) }";
code_ += "}"; code_ += "}";
code_ += "";
if (parser_.file_identifier_.length()) { if (parser_.file_identifier_.length()) {
// Declare the identifier // Declare the identifier
@@ -2652,6 +2714,8 @@ class RustGenerator : public BaseGenerator {
} }
// Generate an accessor struct with constructor for a flatbuffers struct. // Generate an accessor struct with constructor for a flatbuffers struct.
void GenStruct(const StructDef& struct_def) { void GenStruct(const StructDef& struct_def) {
code_ += "";
const bool is_private = const bool is_private =
parser_.opts.no_leak_private_annotations && parser_.opts.no_leak_private_annotations &&
(struct_def.attributes.Lookup("private") != nullptr); (struct_def.attributes.Lookup("private") != nullptr);
@@ -2674,11 +2738,14 @@ class RustGenerator : public BaseGenerator {
code_ += "#[repr(transparent)]"; code_ += "#[repr(transparent)]";
code_ += "#[derive(Clone, Copy, PartialEq)]"; code_ += "#[derive(Clone, Copy, PartialEq)]";
code_ += "{{ACCESS_TYPE}} struct {{STRUCT_TY}}(pub [u8; {{STRUCT_SIZE}}]);"; code_ += "{{ACCESS_TYPE}} struct {{STRUCT_TY}}(pub [u8; {{STRUCT_SIZE}}]);";
code_ += "";
code_ += "impl Default for {{STRUCT_TY}} { "; code_ += "impl Default for {{STRUCT_TY}} { ";
code_ += " fn default() -> Self { "; code_ += " fn default() -> Self { ";
code_ += " Self([0; {{STRUCT_SIZE}}])"; code_ += " Self([0; {{STRUCT_SIZE}}])";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
// Debug for structs. // Debug for structs.
code_ += "impl ::core::fmt::Debug for {{STRUCT_TY}} {"; code_ += "impl ::core::fmt::Debug for {{STRUCT_TY}} {";
@@ -2699,15 +2766,21 @@ class RustGenerator : public BaseGenerator {
// Follow for the value type, Follow for the reference type, Push for the // Follow for the value type, Follow for the reference type, Push for the
// value type, and Push for the reference type. // value type, and Push for the reference type.
code_ += "impl ::flatbuffers::SimpleToVerifyInSlice for {{STRUCT_TY}} {}"; code_ += "impl ::flatbuffers::SimpleToVerifyInSlice for {{STRUCT_TY}} {}";
code_ += "";
code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{STRUCT_TY}} {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for {{STRUCT_TY}} {";
code_ += " type Inner = &'a {{STRUCT_TY}};"; code_ += " type Inner = &'a {{STRUCT_TY}};";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += " unsafe { <&'a {{STRUCT_TY}}>::follow(buf, loc) }"; code_ += " unsafe { <&'a {{STRUCT_TY}}>::follow(buf, loc) }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
code_ += "impl<'a> ::flatbuffers::Follow<'a> for &'a {{STRUCT_TY}} {"; code_ += "impl<'a> ::flatbuffers::Follow<'a> for &'a {{STRUCT_TY}} {";
code_ += " type Inner = &'a {{STRUCT_TY}};"; code_ += " type Inner = &'a {{STRUCT_TY}};";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {"; code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += code_ +=
@@ -2715,8 +2788,11 @@ class RustGenerator : public BaseGenerator {
"loc) }"; "loc) }";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
code_ += "impl<'b> ::flatbuffers::Push for {{STRUCT_TY}} {"; code_ += "impl<'b> ::flatbuffers::Push for {{STRUCT_TY}} {";
code_ += " type Output = {{STRUCT_TY}};"; code_ += " type Output = {{STRUCT_TY}};";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {"; code_ += " unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {";
code_ += code_ +=
@@ -2725,6 +2801,8 @@ class RustGenerator : public BaseGenerator {
"{{STRUCT_TY}} as *const u8, <Self as ::flatbuffers::Push>::size()) };"; "{{STRUCT_TY}} as *const u8, <Self as ::flatbuffers::Push>::size()) };";
code_ += " dst.copy_from_slice(src);"; code_ += " dst.copy_from_slice(src);";
code_ += " }"; code_ += " }";
code_ += "";
code_ += " #[inline]"; code_ += " #[inline]";
code_ += " fn alignment() -> ::flatbuffers::PushAlignment {"; code_ += " fn alignment() -> ::flatbuffers::PushAlignment {";
code_ += " ::flatbuffers::PushAlignment::new({{ALIGN}})"; code_ += " ::flatbuffers::PushAlignment::new({{ALIGN}})";
@@ -2934,11 +3012,11 @@ class RustGenerator : public BaseGenerator {
} }
code_ += "}"; // End impl Struct methods. code_ += "}"; // End impl Struct methods.
code_ += "";
// Generate Struct Object. // Generate Struct Object.
if (parser_.opts.generate_object_based_api) { if (parser_.opts.generate_object_based_api) {
// Struct declaration // Struct declaration
code_ += "";
code_ += "#[derive(Debug, Clone, PartialEq, Default)]"; code_ += "#[derive(Debug, Clone, PartialEq, Default)]";
code_ += "{{ACCESS_TYPE}} struct {{STRUCT_OTY}} {"; code_ += "{{ACCESS_TYPE}} struct {{STRUCT_OTY}} {";
ForAllStructFields(struct_def, [&](const FieldDef& field) { ForAllStructFields(struct_def, [&](const FieldDef& field) {
@@ -2946,6 +3024,8 @@ class RustGenerator : public BaseGenerator {
code_ += "pub {{FIELD}}: {{FIELD_OTY}},"; code_ += "pub {{FIELD}}: {{FIELD_OTY}},";
}); });
code_ += "}"; code_ += "}";
code_ += "";
// The `pack` method that turns the native struct into its Flatbuffers // The `pack` method that turns the native struct into its Flatbuffers
// counterpart. // counterpart.
code_ += "impl {{STRUCT_OTY}} {"; code_ += "impl {{STRUCT_OTY}} {";
@@ -2969,16 +3049,13 @@ class RustGenerator : public BaseGenerator {
code_ += " )"; code_ += " )";
code_ += " }"; code_ += " }";
code_ += "}"; code_ += "}";
code_ += "";
} }
} }
void GenNamespaceImports(const int white_spaces) { void GenNamespaceImports() {
// DO not use global attributes (i.e. #![...]) since it interferes // DO not use global attributes (i.e. #![...]) since it interferes
// with users who include! generated files. // with users who include! generated files.
// See: https://github.com/google/flatbuffers/issues/6261 // See: https://github.com/google/flatbuffers/issues/6261
std::string indent = std::string(white_spaces, ' ');
code_ += "";
if (!parser_.opts.generate_all) { if (!parser_.opts.generate_all) {
for (auto it = parser_.included_files_.begin(); for (auto it = parser_.included_files_.begin();
it != parser_.included_files_.end(); ++it) { it != parser_.included_files_.end(); ++it) {
@@ -2987,23 +3064,22 @@ class RustGenerator : public BaseGenerator {
auto basename = flatbuffers::StripPath(noext); auto basename = flatbuffers::StripPath(noext);
if (parser_.opts.include_prefix.empty()) { if (parser_.opts.include_prefix.empty()) {
code_ += indent + "use crate::" + basename + code_ +=
parser_.opts.filename_suffix + "::*;"; "use crate::" + basename + parser_.opts.filename_suffix + "::*;";
} else { } else {
auto prefix = parser_.opts.include_prefix; auto prefix = parser_.opts.include_prefix;
prefix.pop_back(); prefix.pop_back();
code_ += indent + "use crate::" + prefix + "::" + basename + code_ += "use crate::" + prefix + "::" + basename +
parser_.opts.filename_suffix + "::*;"; parser_.opts.filename_suffix + "::*;";
} }
} }
} }
if (parser_.opts.rust_serialize) { if (parser_.opts.rust_serialize) {
code_ += indent + "extern crate serde;"; code_ += "extern crate serde;";
code_ += code_ +=
indent +
"use self::serde::ser::{Serialize, Serializer, SerializeStruct};"; "use self::serde::ser::{Serialize, Serializer, SerializeStruct};";
code_ += "";
} }
code_ += "extern crate alloc;"; code_ += "extern crate alloc;";
} }
@@ -3036,22 +3112,18 @@ class RustGenerator : public BaseGenerator {
// Close cur_name_space in reverse order to reach the common prefix. // Close cur_name_space in reverse order to reach the common prefix.
// In the previous example, D then C are closed. // In the previous example, D then C are closed.
for (size_t j = old_size; j > common_prefix_size; --j) { for (size_t j = old_size; j > common_prefix_size; --j) {
code_ += "} // pub mod " + cur_name_space_->components[j - 1]; code_.DecrementIdentLevel();
} code_ += "} // pub mod " + cur_name_space_->components[j - 1];
if (old_size != common_prefix_size) {
code_ += "";
} }
// open namespace parts to reach the ns namespace // open namespace parts to reach the ns namespace
// in the previous example, E, then F, then G are opened // in the previous example, E, then F, then G are opened
for (auto j = common_prefix_size; j != new_size; ++j) { for (auto j = common_prefix_size; j != new_size; ++j) {
code_ += "";
code_ += "#[allow(unused_imports, dead_code)]"; code_ += "#[allow(unused_imports, dead_code)]";
code_ += "pub mod " + namer_.Namespace(ns->components[j]) + " {"; code_ += "pub mod " + namer_.Namespace(ns->components[j]) + " {";
// Generate local namespace imports. code_.IncrementIdentLevel();
GenNamespaceImports(2); GenNamespaceImports();
}
if (new_size != common_prefix_size) {
code_ += "";
} }
cur_name_space_ = ns; cur_name_space_ = ns;

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct ArrayStruct, aligned to 8 // struct ArrayStruct, aligned to 8
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct ArrayStruct(pub [u8; 160]); pub struct ArrayStruct(pub [u8; 160]);
impl Default for ArrayStruct { impl Default for ArrayStruct {
fn default() -> Self { fn default() -> Self {
Self([0; 160]) Self([0; 160])
} }
} }
impl ::core::fmt::Debug for ArrayStruct { impl ::core::fmt::Debug for ArrayStruct {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("ArrayStruct") f.debug_struct("ArrayStruct")
@@ -25,27 +28,34 @@ impl ::core::fmt::Debug for ArrayStruct {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for ArrayStruct {} impl ::flatbuffers::SimpleToVerifyInSlice for ArrayStruct {}
impl<'a> ::flatbuffers::Follow<'a> for ArrayStruct { impl<'a> ::flatbuffers::Follow<'a> for ArrayStruct {
type Inner = &'a ArrayStruct; type Inner = &'a ArrayStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a ArrayStruct>::follow(buf, loc) } unsafe { <&'a ArrayStruct>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a ArrayStruct { impl<'a> ::flatbuffers::Follow<'a> for &'a ArrayStruct {
type Inner = &'a ArrayStruct; type Inner = &'a ArrayStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<ArrayStruct>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<ArrayStruct>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for ArrayStruct { impl<'b> ::flatbuffers::Push for ArrayStruct {
type Output = ArrayStruct; type Output = ArrayStruct;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
@@ -244,6 +254,7 @@ pub struct ArrayStructT {
pub e: i32, pub e: i32,
pub f: [i64; 2], pub f: [i64; 2],
} }
impl ArrayStructT { impl ArrayStructT {
pub fn pack(&self) -> ArrayStruct { pub fn pack(&self) -> ArrayStruct {
ArrayStruct::new( ArrayStruct::new(
@@ -256,4 +267,3 @@ impl ArrayStructT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum ArrayTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum ArrayTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ArrayTable<'a> { pub struct ArrayTable<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for ArrayTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for ArrayTable<'a> {
type Inner = ArrayTable<'a>; type Inner = ArrayTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> ArrayTable<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ArrayTable { _tab: table } ArrayTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for ArrayTable<'_> {
Ok(()) Ok(())
} }
} }
pub struct ArrayTableArgs<'a> { pub struct ArrayTableArgs<'a> {
pub a: Option<&'a ArrayStruct>, pub a: Option<&'a ArrayStruct>,
} }
impl<'a> Default for ArrayTableArgs<'a> { impl<'a> Default for ArrayTableArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct ArrayTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: &ArrayStruct) { pub fn add_a(&mut self, a: &ArrayStruct) {
self.fbb_.push_slot_always::<&ArrayStruct>(ArrayTable::VT_A, a); self.fbb_.push_slot_always::<&ArrayStruct>(ArrayTable::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<ArrayTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<ArrayTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for ArrayTable<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct ArrayTableT { pub struct ArrayTableT {
pub a: Option<ArrayStructT>, pub a: Option<ArrayStructT>,
} }
impl Default for ArrayTableT { impl Default for ArrayTableT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for ArrayTableT {
} }
} }
} }
impl ArrayTableT { impl ArrayTableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
@@ -134,66 +145,73 @@ impl ArrayTableT {
}) })
} }
} }
#[inline]
/// Verifies that a buffer of bytes contains a `ArrayTable` /// Verifies that a buffer of bytes contains a `ArrayTable`
/// and returns it. /// and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`. /// `root_as_array_table_unchecked`.
#[inline]
pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<ArrayTable>(buf) ::flatbuffers::root::<ArrayTable>(buf)
} }
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
/// `ArrayTable` and returns it. /// `ArrayTable` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_array_table_unchecked`. /// `size_prefixed_root_as_array_table_unchecked`.
#[inline]
pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<ArrayTable>(buf) ::flatbuffers::size_prefixed_root::<ArrayTable>(buf)
} }
#[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
/// contains a `ArrayTable` and returns it. /// contains a `ArrayTable` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`. /// `root_as_array_table_unchecked`.
#[inline]
pub fn root_as_array_table_with_opts<'b, 'o>( pub fn root_as_array_table_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<ArrayTable<'b>>(opts, buf) ::flatbuffers::root_with_opts::<ArrayTable<'b>>(opts, buf)
} }
#[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `ArrayTable` and returns /// bytes contains a size prefixed `ArrayTable` and returns
/// it. Note that verification is still experimental and may not /// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`. /// `root_as_array_table_unchecked`.
#[inline]
pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>( pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<ArrayTable<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<ArrayTable<'b>>(opts, buf)
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it. /// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `ArrayTable`. /// Callers must trust the given bytes do indeed contain a valid `ArrayTable`.
#[inline]
pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> { pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
unsafe { ::flatbuffers::root_unchecked::<ArrayTable>(buf) } unsafe { ::flatbuffers::root_unchecked::<ArrayTable>(buf) }
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`.
#[inline]
pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> { pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) }
} }
pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT"; pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT";
#[inline] #[inline]

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct NestedStruct, aligned to 8 // struct NestedStruct, aligned to 8
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct NestedStruct(pub [u8; 32]); pub struct NestedStruct(pub [u8; 32]);
impl Default for NestedStruct { impl Default for NestedStruct {
fn default() -> Self { fn default() -> Self {
Self([0; 32]) Self([0; 32])
} }
} }
impl ::core::fmt::Debug for NestedStruct { impl ::core::fmt::Debug for NestedStruct {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("NestedStruct") f.debug_struct("NestedStruct")
@@ -23,27 +26,34 @@ impl ::core::fmt::Debug for NestedStruct {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for NestedStruct {} impl ::flatbuffers::SimpleToVerifyInSlice for NestedStruct {}
impl<'a> ::flatbuffers::Follow<'a> for NestedStruct { impl<'a> ::flatbuffers::Follow<'a> for NestedStruct {
type Inner = &'a NestedStruct; type Inner = &'a NestedStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a NestedStruct>::follow(buf, loc) } unsafe { <&'a NestedStruct>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a NestedStruct { impl<'a> ::flatbuffers::Follow<'a> for &'a NestedStruct {
type Inner = &'a NestedStruct; type Inner = &'a NestedStruct;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<NestedStruct>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<NestedStruct>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for NestedStruct { impl<'b> ::flatbuffers::Push for NestedStruct {
type Output = NestedStruct; type Output = NestedStruct;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
@@ -176,6 +186,7 @@ pub struct NestedStructT {
pub c: [TestEnum; 2], pub c: [TestEnum; 2],
pub d: [i64; 2], pub d: [i64; 2],
} }
impl NestedStructT { impl NestedStructT {
pub fn pack(&self) -> NestedStruct { pub fn pack(&self) -> NestedStruct {
NestedStruct::new( NestedStruct::new(
@@ -186,4 +197,3 @@ impl NestedStructT {
) )
} }
} }

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_TEST_ENUM: i8 = 0; pub const ENUM_MIN_TEST_ENUM: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_TEST_ENUM: i8 = 2; pub const ENUM_MAX_TEST_ENUM: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_TEST_ENUM: [TestEnum; 3] = [ pub const ENUM_VALUES_TEST_ENUM: [TestEnum; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_TEST_ENUM: [TestEnum; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct TestEnum(pub i8); pub struct TestEnum(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl TestEnum { impl TestEnum {
pub const A: Self = Self(0); pub const A: Self = Self(0);
@@ -30,6 +34,7 @@ impl TestEnum {
Self::B, Self::B,
Self::C, Self::C,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl TestEnum {
} }
} }
} }
impl ::core::fmt::Debug for TestEnum { impl ::core::fmt::Debug for TestEnum {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for TestEnum {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for TestEnum { impl<'a> ::flatbuffers::Follow<'a> for TestEnum {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for TestEnum {
impl ::flatbuffers::Push for TestEnum { impl ::flatbuffers::Push for TestEnum {
type Output = TestEnum; type Output = TestEnum;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for TestEnum {
impl ::flatbuffers::EndianScalar for TestEnum { impl ::flatbuffers::EndianScalar for TestEnum {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0; pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
@@ -15,6 +18,7 @@ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct FromInclude(pub i64); pub struct FromInclude(pub i64);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl FromInclude { impl FromInclude {
pub const IncludeVal: Self = Self(0); pub const IncludeVal: Self = Self(0);
@@ -24,6 +28,7 @@ impl FromInclude {
pub const ENUM_VALUES: &'static [Self] = &[ pub const ENUM_VALUES: &'static [Self] = &[
Self::IncludeVal, Self::IncludeVal,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -32,6 +37,7 @@ impl FromInclude {
} }
} }
} }
impl ::core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -41,8 +47,10 @@ impl ::core::fmt::Debug for FromInclude {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
@@ -52,6 +60,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
impl ::flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
@@ -60,10 +69,12 @@ impl ::flatbuffers::Push for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self { fn from_little_endian(v: i64) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableB<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableB<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) { pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableB<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for TableBT {
} }
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]); pub struct Unused(pub [u8; 4]);
impl Default for Unused { impl Default for Unused {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for Unused {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> ::flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -110,6 +120,7 @@ impl<'a> Unused {
pub struct UnusedT { pub struct UnusedT {
pub a: i32, pub a: i32,
} }
impl UnusedT { impl UnusedT {
pub fn pack(&self) -> Unused { pub fn pack(&self) -> Unused {
Unused::new( Unused::new(
@@ -117,4 +128,3 @@ impl UnusedT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for TableAT {
} }
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -1,17 +1,17 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
pub enum TableAOffset {} pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +29,7 @@ impl<'a> TableA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -68,9 +69,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -84,11 +87,13 @@ pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -97,6 +102,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -111,11 +117,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -123,6 +131,7 @@ impl Default for TableAT {
} }
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
@@ -136,344 +145,374 @@ impl TableAT {
}) })
} }
} }
#[allow(unused_imports, dead_code)] #[allow(unused_imports, dead_code)]
pub mod my_game { pub mod my_game {
extern crate alloc;
extern crate alloc; #[allow(unused_imports, dead_code)]
#[allow(unused_imports, dead_code)] pub mod other_name_space {
pub mod other_name_space { extern crate alloc;
extern crate alloc; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0; pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
FromInclude::IncludeVal,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[repr(transparent)] #[allow(non_camel_case_types)]
pub struct FromInclude(pub i64); pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[allow(non_upper_case_globals)] FromInclude::IncludeVal,
impl FromInclude { ];
pub const IncludeVal: Self = Self(0);
pub const ENUM_MIN: i64 = 0; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub const ENUM_MAX: i64 = 0; #[repr(transparent)]
pub const ENUM_VALUES: &'static [Self] = &[ pub struct FromInclude(pub i64);
Self::IncludeVal,
]; #[allow(non_upper_case_globals)]
/// Returns the variant's name or "" if unknown. impl FromInclude {
pub fn variant_name(self) -> Option<&'static str> { pub const IncludeVal: Self = Self(0);
match self {
Self::IncludeVal => Some("IncludeVal"), pub const ENUM_MIN: i64 = 0;
_ => None, pub const ENUM_MAX: i64 = 0;
pub const ENUM_VALUES: &'static [Self] = &[
Self::IncludeVal,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::IncludeVal => Some("IncludeVal"),
_ => None,
}
}
} }
}
} impl ::core::fmt::Debug for FromInclude {
impl ::core::fmt::Debug for FromInclude { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { if let Some(name) = self.variant_name() {
if let Some(name) = self.variant_name() { f.write_str(name)
f.write_str(name) } else {
} else { f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0)) }
}
} }
}
}
impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b)
}
}
impl ::flatbuffers::Push for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Output = FromInclude; type Inner = Self;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { #[inline]
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) }; unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b)
}
} }
}
impl ::flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Scalar = i64; type Output = FromInclude;
#[inline]
fn to_little_endian(self) -> i64 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self {
let b = i64::from_le(v);
Self(b)
}
}
impl<'a> ::flatbuffers::Verifiable for FromInclude { #[inline]
#[inline] unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
fn run_verifier( unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
v: &mut ::flatbuffers::Verifier, pos: usize }
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
i64::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}
// struct Unused, aligned to 4
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]);
impl Default for Unused {
fn default() -> Self {
Self([0; 4])
}
}
impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
} }
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment { impl ::flatbuffers::EndianScalar for FromInclude {
::flatbuffers::PushAlignment::new(4) type Scalar = i64;
#[inline]
fn to_little_endian(self) -> i64 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self {
let b = i64::from_le(v);
Self(b)
}
} }
}
impl<'a> ::flatbuffers::Verifiable for Unused { impl<'a> ::flatbuffers::Verifiable for FromInclude {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos) i64::run_verifier(v, pos)
} }
}
impl<'a> Unused {
#[allow(clippy::too_many_arguments)]
pub fn new(
a: i32,
) -> Self {
let mut s = Self([0; 4]);
s.set_a(a);
s
}
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.Unused"
}
pub fn a(&self) -> i32 {
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::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 ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_a(&mut self, x: i32) {
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(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
} }
}
pub fn unpack(&self) -> UnusedT { impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}
UnusedT {
a: self.a(), // struct Unused, aligned to 4
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]);
impl Default for Unused {
fn default() -> Self {
Self([0; 4])
}
} }
}
}
#[derive(Debug, Clone, PartialEq, Default)] impl ::core::fmt::Debug for Unused {
pub struct UnusedT { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
pub a: i32, f.debug_struct("Unused")
} .field("a", &self.a())
impl UnusedT { .finish()
pub fn pack(&self) -> Unused { }
Unused::new(
self.a,
)
}
}
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> TableB<'a> {
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
}
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
} }
}
#[inline] impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
pub fn a(&self) -> Option<super::super::TableA<'a>> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl ::flatbuffers::Verifiable for TableB<'_> { impl<'a> ::flatbuffers::Follow<'a> for Unused {
#[inline] type Inner = &'a Unused;
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize #[inline]
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
v.visit_table(pos)? unsafe { <&'a Unused>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
}
}
impl<'a> ::flatbuffers::Verifiable for Unused {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
impl<'a> Unused {
#[allow(clippy::too_many_arguments)]
pub fn new(
a: i32,
) -> Self {
let mut s = Self([0; 4]);
s.set_a(a);
s
}
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.Unused"
}
pub fn a(&self) -> i32 {
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::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 ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_a(&mut self, x: i32) {
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(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
pub fn unpack(&self) -> UnusedT {
UnusedT {
a: self.a(),
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UnusedT {
pub a: i32,
}
impl UnusedT {
pub fn pack(&self) -> Unused {
Unused::new(
self.a,
)
}
}
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> TableB<'a> {
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
}
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
}
}
#[inline]
pub fn a(&self) -> Option<super::super::TableA<'a>> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
}
pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
}
impl<'a> Default for TableBArgs<'a> {
#[inline]
fn default() -> Self {
TableBArgs {
a: None,
} }
}
}
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { pub struct TableBArgs<'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
start_: start,
} }
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for TableB<'_> { impl<'a> Default for TableBArgs<'a> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { #[inline]
let mut ds = f.debug_struct("TableB"); fn default() -> Self {
ds.field("a", &self.a()); TableBArgs {
ds.finish() a: None,
} }
} }
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
Self {
a: None,
} }
}
}
impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});
TableB::create(_fbb, &TableBArgs{
a,
})
}
}
} // pub mod OtherNameSpace
} // pub mod MyGame
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
Self {
a: None,
}
}
}
impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});
TableB::create(_fbb, &TableBArgs{
a,
})
}
}
} // pub mod OtherNameSpace
} // pub mod MyGame

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0; pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
@@ -15,6 +18,7 @@ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct FromInclude(pub i64); pub struct FromInclude(pub i64);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl FromInclude { impl FromInclude {
pub const IncludeVal: Self = Self(0); pub const IncludeVal: Self = Self(0);
@@ -24,6 +28,7 @@ impl FromInclude {
pub const ENUM_VALUES: &'static [Self] = &[ pub const ENUM_VALUES: &'static [Self] = &[
Self::IncludeVal, Self::IncludeVal,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -32,6 +37,7 @@ impl FromInclude {
} }
} }
} }
impl ::core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -41,8 +47,10 @@ impl ::core::fmt::Debug for FromInclude {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
@@ -52,6 +60,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
impl ::flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
@@ -60,10 +69,12 @@ impl ::flatbuffers::Push for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self { fn from_little_endian(v: i64) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableB<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableB<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) { pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableB<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for TableBT {
} }
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]); pub struct Unused(pub [u8; 4]);
impl Default for Unused { impl Default for Unused {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for Unused {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> ::flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -110,6 +120,7 @@ impl<'a> Unused {
pub struct UnusedT { pub struct UnusedT {
pub a: i32, pub a: i32,
} }
impl UnusedT { impl UnusedT {
pub fn pack(&self) -> Unused { pub fn pack(&self) -> Unused {
Unused::new( Unused::new(
@@ -117,4 +128,3 @@ impl UnusedT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for TableAT {
} }
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -1,17 +1,17 @@
// automatically generated by the FlatBuffers compiler, do not modify // automatically generated by the FlatBuffers compiler, do not modify
// @generated // @generated
extern crate alloc; extern crate alloc;
pub enum TableAOffset {} pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +29,7 @@ impl<'a> TableA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -68,9 +69,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -84,11 +87,13 @@ pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -97,6 +102,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -111,11 +117,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -123,6 +131,7 @@ impl Default for TableAT {
} }
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
@@ -136,344 +145,374 @@ impl TableAT {
}) })
} }
} }
#[allow(unused_imports, dead_code)] #[allow(unused_imports, dead_code)]
pub mod my_game { pub mod my_game {
extern crate alloc;
extern crate alloc; #[allow(unused_imports, dead_code)]
#[allow(unused_imports, dead_code)] pub mod other_name_space {
pub mod other_name_space { extern crate alloc;
extern crate alloc; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0; pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
FromInclude::IncludeVal,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[repr(transparent)] #[allow(non_camel_case_types)]
pub struct FromInclude(pub i64); pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[allow(non_upper_case_globals)] FromInclude::IncludeVal,
impl FromInclude { ];
pub const IncludeVal: Self = Self(0);
pub const ENUM_MIN: i64 = 0; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub const ENUM_MAX: i64 = 0; #[repr(transparent)]
pub const ENUM_VALUES: &'static [Self] = &[ pub struct FromInclude(pub i64);
Self::IncludeVal,
]; #[allow(non_upper_case_globals)]
/// Returns the variant's name or "" if unknown. impl FromInclude {
pub fn variant_name(self) -> Option<&'static str> { pub const IncludeVal: Self = Self(0);
match self {
Self::IncludeVal => Some("IncludeVal"), pub const ENUM_MIN: i64 = 0;
_ => None, pub const ENUM_MAX: i64 = 0;
pub const ENUM_VALUES: &'static [Self] = &[
Self::IncludeVal,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::IncludeVal => Some("IncludeVal"),
_ => None,
}
}
} }
}
} impl ::core::fmt::Debug for FromInclude {
impl ::core::fmt::Debug for FromInclude { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { if let Some(name) = self.variant_name() {
if let Some(name) = self.variant_name() { f.write_str(name)
f.write_str(name) } else {
} else { f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0)) }
}
} }
}
}
impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b)
}
}
impl ::flatbuffers::Push for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Output = FromInclude; type Inner = Self;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { #[inline]
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) }; unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
Self(b)
}
} }
}
impl ::flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Scalar = i64; type Output = FromInclude;
#[inline]
fn to_little_endian(self) -> i64 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self {
let b = i64::from_le(v);
Self(b)
}
}
impl<'a> ::flatbuffers::Verifiable for FromInclude { #[inline]
#[inline] unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
fn run_verifier( unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
v: &mut ::flatbuffers::Verifier, pos: usize }
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
i64::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}
// struct Unused, aligned to 4
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]);
impl Default for Unused {
fn default() -> Self {
Self([0; 4])
}
}
impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
} }
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment { impl ::flatbuffers::EndianScalar for FromInclude {
::flatbuffers::PushAlignment::new(4) type Scalar = i64;
#[inline]
fn to_little_endian(self) -> i64 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self {
let b = i64::from_le(v);
Self(b)
}
} }
}
impl<'a> ::flatbuffers::Verifiable for Unused { impl<'a> ::flatbuffers::Verifiable for FromInclude {
#[inline] #[inline]
fn run_verifier( fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos) i64::run_verifier(v, pos)
} }
}
impl<'a> Unused {
#[allow(clippy::too_many_arguments)]
pub fn new(
a: i32,
) -> Self {
let mut s = Self([0; 4]);
s.set_a(a);
s
}
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.Unused"
}
pub fn a(&self) -> i32 {
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::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 ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_a(&mut self, x: i32) {
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(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
} }
}
pub fn unpack(&self) -> UnusedT { impl ::flatbuffers::SimpleToVerifyInSlice for FromInclude {}
UnusedT {
a: self.a(), // struct Unused, aligned to 4
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]);
impl Default for Unused {
fn default() -> Self {
Self([0; 4])
}
} }
}
}
#[derive(Debug, Clone, PartialEq, Default)] impl ::core::fmt::Debug for Unused {
pub struct UnusedT { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
pub a: i32, f.debug_struct("Unused")
} .field("a", &self.a())
impl UnusedT { .finish()
pub fn pack(&self) -> Unused { }
Unused::new(
self.a,
)
}
}
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> TableB<'a> {
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
}
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
} }
}
#[inline] impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
pub fn a(&self) -> Option<super::super::TableA<'a>> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl ::flatbuffers::Verifiable for TableB<'_> { impl<'a> ::flatbuffers::Follow<'a> for Unused {
#[inline] type Inner = &'a Unused;
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize #[inline]
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
v.visit_table(pos)? unsafe { <&'a Unused>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
}
}
impl<'a> ::flatbuffers::Verifiable for Unused {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
impl<'a> Unused {
#[allow(clippy::too_many_arguments)]
pub fn new(
a: i32,
) -> Self {
let mut s = Self([0; 4]);
s.set_a(a);
s
}
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.Unused"
}
pub fn a(&self) -> i32 {
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::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 ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_a(&mut self, x: i32) {
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(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
pub fn unpack(&self) -> UnusedT {
UnusedT {
a: self.a(),
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UnusedT {
pub a: i32,
}
impl UnusedT {
pub fn pack(&self) -> Unused {
Unused::new(
self.a,
)
}
}
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> TableB<'a> {
pub const VT_A: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.OtherNameSpace.TableB"
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args TableBArgs<'args>
) -> ::flatbuffers::WIPOffset<TableB<'bldr>> {
let mut builder = TableBBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
}
pub fn unpack(&self) -> TableBT {
let a = self.a().map(|x| {
alloc::boxed::Box::new(x.unpack())
});
TableBT {
a,
}
}
#[inline]
pub fn a(&self) -> Option<super::super::TableA<'a>> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::super::TableA>>(TableB::VT_A, None)}
}
}
impl ::flatbuffers::Verifiable for TableB<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)? .visit_field::<::flatbuffers::ForwardsUOffset<super::super::TableA>>("a", Self::VT_A, false)?
.finish(); .finish();
Ok(()) Ok(())
} }
}
pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
}
impl<'a> Default for TableBArgs<'a> {
#[inline]
fn default() -> Self {
TableBArgs {
a: None,
} }
}
}
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { pub struct TableBArgs<'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
start_: start,
} }
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for TableB<'_> { impl<'a> Default for TableBArgs<'a> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { #[inline]
let mut ds = f.debug_struct("TableB"); fn default() -> Self {
ds.field("a", &self.a()); TableBArgs {
ds.finish() a: None,
} }
} }
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
Self {
a: None,
} }
}
}
impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});
TableB::create(_fbb, &TableBArgs{
a,
})
}
}
} // pub mod OtherNameSpace
} // pub mod MyGame
pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table();
TableBBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
}
impl Default for TableBT {
fn default() -> Self {
Self {
a: None,
}
}
}
impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<TableB<'b>> {
let a = self.a.as_ref().map(|x|{
x.pack(_fbb)
});
TableB::create(_fbb, &TableBArgs{
a,
})
}
}
} // pub mod OtherNameSpace
} // pub mod MyGame

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ABC: i32 = 0; pub const ENUM_MIN_ABC: i32 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ABC: i32 = 2; pub const ENUM_MAX_ABC: i32 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ABC: [ABC; 3] = [ pub const ENUM_VALUES_ABC: [ABC; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_ABC: [ABC; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct ABC(pub i32); pub struct ABC(pub i32);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl ABC { impl ABC {
pub const void: Self = Self(0); pub const void: Self = Self(0);
@@ -30,6 +34,7 @@ impl ABC {
Self::where_, Self::where_,
Self::stackalloc, Self::stackalloc,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl ABC {
} }
} }
} }
impl ::core::fmt::Debug for ABC { impl ::core::fmt::Debug for ABC {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for ABC {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for ABC { impl<'a> ::flatbuffers::Follow<'a> for ABC {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for ABC {
impl ::flatbuffers::Push for ABC { impl ::flatbuffers::Push for ABC {
type Output = ABC; type Output = ABC;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for ABC {
impl ::flatbuffers::EndianScalar for ABC { impl ::flatbuffers::EndianScalar for ABC {
type Scalar = i32; type Scalar = i32;
#[inline] #[inline]
fn to_little_endian(self) -> i32 { fn to_little_endian(self) -> i32 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i32) -> Self { fn from_little_endian(v: i32) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum KeywordsInTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum KeywordsInTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct KeywordsInTable<'a> { pub struct KeywordsInTable<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for KeywordsInTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for KeywordsInTable<'a> {
type Inner = KeywordsInTable<'a>; type Inner = KeywordsInTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -31,6 +33,7 @@ impl<'a> KeywordsInTable<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
KeywordsInTable { _tab: table } KeywordsInTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -64,6 +67,7 @@ impl<'a> KeywordsInTable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<ABC>(KeywordsInTable::VT_IS, Some(ABC::void)).unwrap()} unsafe { self._tab.get::<ABC>(KeywordsInTable::VT_IS, Some(ABC::void)).unwrap()}
} }
#[inline] #[inline]
pub fn private(&self) -> public { pub fn private(&self) -> public {
// Safety: // Safety:
@@ -71,6 +75,7 @@ impl<'a> KeywordsInTable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<public>(KeywordsInTable::VT_PRIVATE, Some(public::NONE)).unwrap()} unsafe { self._tab.get::<public>(KeywordsInTable::VT_PRIVATE, Some(public::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn type_(&self) -> i32 { pub fn type_(&self) -> i32 {
// Safety: // Safety:
@@ -78,6 +83,7 @@ impl<'a> KeywordsInTable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(KeywordsInTable::VT_TYPE_, Some(0)).unwrap()} unsafe { self._tab.get::<i32>(KeywordsInTable::VT_TYPE_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn default(&self) -> bool { pub fn default(&self) -> bool {
// Safety: // Safety:
@@ -101,12 +107,14 @@ impl ::flatbuffers::Verifiable for KeywordsInTable<'_> {
Ok(()) Ok(())
} }
} }
pub struct KeywordsInTableArgs { pub struct KeywordsInTableArgs {
pub is: ABC, pub is: ABC,
pub private: public, pub private: public,
pub type_: i32, pub type_: i32,
pub default: bool, pub default: bool,
} }
impl<'a> Default for KeywordsInTableArgs { impl<'a> Default for KeywordsInTableArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -123,23 +131,28 @@ pub struct KeywordsInTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a>
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_is(&mut self, is: ABC) { pub fn add_is(&mut self, is: ABC) {
self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void); self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void);
} }
#[inline] #[inline]
pub fn add_private(&mut self, private: public) { pub fn add_private(&mut self, private: public) {
self.fbb_.push_slot::<public>(KeywordsInTable::VT_PRIVATE, private, public::NONE); self.fbb_.push_slot::<public>(KeywordsInTable::VT_PRIVATE, private, public::NONE);
} }
#[inline] #[inline]
pub fn add_type_(&mut self, type_: i32) { pub fn add_type_(&mut self, type_: i32) {
self.fbb_.push_slot::<i32>(KeywordsInTable::VT_TYPE_, type_, 0); self.fbb_.push_slot::<i32>(KeywordsInTable::VT_TYPE_, type_, 0);
} }
#[inline] #[inline]
pub fn add_default(&mut self, default: bool) { pub fn add_default(&mut self, default: bool) {
self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false); self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -148,6 +161,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<KeywordsInTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<KeywordsInTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -165,6 +179,7 @@ impl ::core::fmt::Debug for KeywordsInTable<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct KeywordsInTableT { pub struct KeywordsInTableT {
@@ -173,6 +188,7 @@ pub struct KeywordsInTableT {
pub type_: i32, pub type_: i32,
pub default: bool, pub default: bool,
} }
impl Default for KeywordsInTableT { impl Default for KeywordsInTableT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -183,6 +199,7 @@ impl Default for KeywordsInTableT {
} }
} }
} }
impl KeywordsInTableT { impl KeywordsInTableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0; pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_KEYWORDS_IN_UNION: u8 = 2; pub const ENUM_MAX_KEYWORDS_IN_UNION: u8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_KEYWORDS_IN_UNION: [KeywordsInUnion; 3] = [ pub const ENUM_VALUES_KEYWORDS_IN_UNION: [KeywordsInUnion; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_KEYWORDS_IN_UNION: [KeywordsInUnion; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct KeywordsInUnion(pub u8); pub struct KeywordsInUnion(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl KeywordsInUnion { impl KeywordsInUnion {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -30,6 +34,7 @@ impl KeywordsInUnion {
Self::static_, Self::static_,
Self::internal, Self::internal,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl KeywordsInUnion {
} }
} }
} }
impl ::core::fmt::Debug for KeywordsInUnion { impl ::core::fmt::Debug for KeywordsInUnion {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for KeywordsInUnion {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for KeywordsInUnion { impl<'a> ::flatbuffers::Follow<'a> for KeywordsInUnion {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for KeywordsInUnion {
impl ::flatbuffers::Push for KeywordsInUnion { impl ::flatbuffers::Push for KeywordsInUnion {
type Output = KeywordsInUnion; type Output = KeywordsInUnion;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for KeywordsInUnion {
impl ::flatbuffers::EndianScalar for KeywordsInUnion { impl ::flatbuffers::EndianScalar for KeywordsInUnion {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -90,6 +101,7 @@ impl<'a> ::flatbuffers::Verifiable for KeywordsInUnion {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {} impl ::flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {}
pub struct KeywordsInUnionUnionTableOffset {} pub struct KeywordsInUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -100,11 +112,13 @@ pub enum KeywordsInUnionT {
Static_(alloc::boxed::Box<KeywordsInTableT>), Static_(alloc::boxed::Box<KeywordsInTableT>),
Internal(alloc::boxed::Box<KeywordsInTableT>), Internal(alloc::boxed::Box<KeywordsInTableT>),
} }
impl Default for KeywordsInUnionT { impl Default for KeywordsInUnionT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl KeywordsInUnionT { impl KeywordsInUnionT {
pub fn keywords_in_union_type(&self) -> KeywordsInUnion { pub fn keywords_in_union_type(&self) -> KeywordsInUnion {
match self { match self {
@@ -113,6 +127,7 @@ impl KeywordsInUnionT {
Self::Internal(_) => KeywordsInUnion::internal, Self::Internal(_) => KeywordsInUnion::internal,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -120,6 +135,7 @@ impl KeywordsInUnionT {
Self::Internal(v) => Some(v.pack(fbb).as_union_value()), Self::Internal(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE. /// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_static_(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> { pub fn take_static_(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
if let Self::Static_(_) = self { if let Self::Static_(_) = self {
@@ -133,14 +149,17 @@ impl KeywordsInUnionT {
None None
} }
} }
/// If the union variant matches, return a reference to the KeywordsInTableT. /// If the union variant matches, return a reference to the KeywordsInTableT.
pub fn as_static_(&self) -> Option<&KeywordsInTableT> { pub fn as_static_(&self) -> Option<&KeywordsInTableT> {
if let Self::Static_(v) = self { Some(v.as_ref()) } else { None } if let Self::Static_(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the KeywordsInTableT. /// If the union variant matches, return a mutable reference to the KeywordsInTableT.
pub fn as_static__mut(&mut self) -> Option<&mut KeywordsInTableT> { pub fn as_static__mut(&mut self) -> Option<&mut KeywordsInTableT> {
if let Self::Static_(v) = self { Some(v.as_mut()) } else { None } if let Self::Static_(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE. /// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_internal(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> { pub fn take_internal(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
if let Self::Internal(_) = self { if let Self::Internal(_) = self {
@@ -154,12 +173,15 @@ impl KeywordsInUnionT {
None None
} }
} }
/// If the union variant matches, return a reference to the KeywordsInTableT. /// If the union variant matches, return a reference to the KeywordsInTableT.
pub fn as_internal(&self) -> Option<&KeywordsInTableT> { pub fn as_internal(&self) -> Option<&KeywordsInTableT> {
if let Self::Internal(v) = self { Some(v.as_ref()) } else { None } if let Self::Internal(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the KeywordsInTableT. /// If the union variant matches, return a mutable reference to the KeywordsInTableT.
pub fn as_internal_mut(&mut self) -> Option<&mut KeywordsInTableT> { pub fn as_internal_mut(&mut self) -> Option<&mut KeywordsInTableT> {
if let Self::Internal(v) = self { Some(v.as_mut()) } else { None } if let Self::Internal(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_PUBLIC: i32 = 0; pub const ENUM_MIN_PUBLIC: i32 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_PUBLIC: i32 = 0; pub const ENUM_MAX_PUBLIC: i32 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_PUBLIC: [public; 1] = [ pub const ENUM_VALUES_PUBLIC: [public; 1] = [
@@ -15,6 +18,7 @@ pub const ENUM_VALUES_PUBLIC: [public; 1] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct public(pub i32); pub struct public(pub i32);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl public { impl public {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -24,6 +28,7 @@ impl public {
pub const ENUM_VALUES: &'static [Self] = &[ pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE, Self::NONE,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -32,6 +37,7 @@ impl public {
} }
} }
} }
impl ::core::fmt::Debug for public { impl ::core::fmt::Debug for public {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -41,8 +47,10 @@ impl ::core::fmt::Debug for public {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for public { impl<'a> ::flatbuffers::Follow<'a> for public {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
@@ -52,6 +60,7 @@ impl<'a> ::flatbuffers::Follow<'a> for public {
impl ::flatbuffers::Push for public { impl ::flatbuffers::Push for public {
type Output = public; type Output = public;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
@@ -60,10 +69,12 @@ impl ::flatbuffers::Push for public {
impl ::flatbuffers::EndianScalar for public { impl ::flatbuffers::EndianScalar for public {
type Scalar = i32; type Scalar = i32;
#[inline] #[inline]
fn to_little_endian(self) -> i32 { fn to_little_endian(self) -> i32 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i32) -> Self { fn from_little_endian(v: i32) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum Table2Offset {}
#[derive(Copy, Clone, PartialEq)]
pub enum Table2Offset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Table2<'a> { pub struct Table2<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Table2<'a> { impl<'a> ::flatbuffers::Follow<'a> for Table2<'a> {
type Inner = Table2<'a>; type Inner = Table2<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +31,7 @@ impl<'a> Table2<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Table2 { _tab: table } Table2 { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,6 +70,7 @@ impl<'a> Table2<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, Some(KeywordsInUnion::NONE)).unwrap()} unsafe { self._tab.get::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, Some(KeywordsInUnion::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn type_(&self) -> Option<::flatbuffers::Table<'a>> { pub fn type_(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -74,6 +78,7 @@ impl<'a> Table2<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn type__as_static_(&self) -> Option<KeywordsInTable<'a>> { pub fn type__as_static_(&self) -> Option<KeywordsInTable<'a>> {
@@ -103,7 +108,6 @@ impl<'a> Table2<'a> {
None None
} }
} }
} }
impl ::flatbuffers::Verifiable for Table2<'_> { impl ::flatbuffers::Verifiable for Table2<'_> {
@@ -123,10 +127,12 @@ impl ::flatbuffers::Verifiable for Table2<'_> {
Ok(()) Ok(())
} }
} }
pub struct Table2Args { pub struct Table2Args {
pub type_type: KeywordsInUnion, pub type_type: KeywordsInUnion,
pub type_: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>, pub type_: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
} }
impl<'a> Default for Table2Args { impl<'a> Default for Table2Args {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -141,15 +147,18 @@ pub struct Table2Builder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_type_type(&mut self, type_type: KeywordsInUnion) { pub fn add_type_type(&mut self, type_type: KeywordsInUnion) {
self.fbb_.push_slot::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, type_type, KeywordsInUnion::NONE); self.fbb_.push_slot::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, type_type, KeywordsInUnion::NONE);
} }
#[inline] #[inline]
pub fn add_type_(&mut self, type_: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_type_(&mut self, type_: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -158,6 +167,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Table2<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Table2<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -192,11 +202,13 @@ impl ::core::fmt::Debug for Table2<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct Table2T { pub struct Table2T {
pub type_: KeywordsInUnionT, pub type_: KeywordsInUnionT,
} }
impl Default for Table2T { impl Default for Table2T {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -204,6 +216,7 @@ impl Default for Table2T {
} }
} }
} }
impl Table2T { impl Table2T {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Ability, aligned to 4 // struct Ability, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Ability(pub [u8; 8]); pub struct Ability(pub [u8; 8]);
impl Default for Ability { impl Default for Ability {
fn default() -> Self { fn default() -> Self {
Self([0; 8]) Self([0; 8])
} }
} }
impl ::core::fmt::Debug for Ability { impl ::core::fmt::Debug for Ability {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Ability") f.debug_struct("Ability")
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for Ability {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Ability {} impl ::flatbuffers::SimpleToVerifyInSlice for Ability {}
impl<'a> ::flatbuffers::Follow<'a> for Ability { impl<'a> ::flatbuffers::Follow<'a> for Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Ability>::follow(buf, loc) } unsafe { <&'a Ability>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Ability { impl<'a> ::flatbuffers::Follow<'a> for &'a Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Ability>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Ability>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Ability { impl<'b> ::flatbuffers::Push for Ability {
type Output = Ability; type Output = Ability;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Ability as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Ability as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -102,6 +112,7 @@ impl<'a> Ability {
} }
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Ability) -> bool { pub fn key_compare_less_than(&self, o: &Ability) -> bool {
self.id() < o.id() self.id() < o.id()
@@ -154,6 +165,7 @@ pub struct AbilityT {
pub id: u32, pub id: u32,
pub distance: u32, pub distance: u32,
} }
impl AbilityT { impl AbilityT {
pub fn pack(&self) -> Ability { pub fn pack(&self) -> Ability {
Ability::new( Ability::new(
@@ -162,4 +174,3 @@ impl AbilityT {
) )
} }
} }

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0; pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3; pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [ pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct AnyAmbiguousAliases(pub u8); pub struct AnyAmbiguousAliases(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl AnyAmbiguousAliases { impl AnyAmbiguousAliases {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -33,6 +37,7 @@ impl AnyAmbiguousAliases {
Self::M2, Self::M2,
Self::M3, Self::M3,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -44,6 +49,7 @@ impl AnyAmbiguousAliases {
} }
} }
} }
impl ::core::fmt::Debug for AnyAmbiguousAliases { impl ::core::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for AnyAmbiguousAliases {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
impl ::flatbuffers::Push for AnyAmbiguousAliases { impl ::flatbuffers::Push for AnyAmbiguousAliases {
type Output = AnyAmbiguousAliases; type Output = AnyAmbiguousAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for AnyAmbiguousAliases {
impl ::flatbuffers::EndianScalar for AnyAmbiguousAliases { impl ::flatbuffers::EndianScalar for AnyAmbiguousAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyAmbiguousAliases {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
pub struct AnyAmbiguousAliasesUnionTableOffset {} pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum AnyAmbiguousAliasesT {
M2(alloc::boxed::Box<MonsterT>), M2(alloc::boxed::Box<MonsterT>),
M3(alloc::boxed::Box<MonsterT>), M3(alloc::boxed::Box<MonsterT>),
} }
impl Default for AnyAmbiguousAliasesT { impl Default for AnyAmbiguousAliasesT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyAmbiguousAliasesT { impl AnyAmbiguousAliasesT {
pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases { pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases {
match self { match self {
@@ -119,6 +133,7 @@ impl AnyAmbiguousAliasesT {
Self::M3(_) => AnyAmbiguousAliases::M3, Self::M3(_) => AnyAmbiguousAliases::M3,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -127,6 +142,7 @@ impl AnyAmbiguousAliasesT {
Self::M3(v) => Some(v.pack(fbb).as_union_value()), Self::M3(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m1(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M1(_) = self { if let Self::M1(_) = self {
@@ -140,14 +156,17 @@ impl AnyAmbiguousAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m1(&self) -> Option<&MonsterT> { pub fn as_m1(&self) -> Option<&MonsterT> {
if let Self::M1(v) = self { Some(v.as_ref()) } else { None } if let Self::M1(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m1_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m1_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M1(v) = self { Some(v.as_mut()) } else { None } if let Self::M1(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
@@ -161,14 +180,17 @@ impl AnyAmbiguousAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m2(&self) -> Option<&MonsterT> { pub fn as_m2(&self) -> Option<&MonsterT> {
if let Self::M2(v) = self { Some(v.as_ref()) } else { None } if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m2_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m2_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M2(v) = self { Some(v.as_mut()) } else { None } if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m3(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M3(_) = self { if let Self::M3(_) = self {
@@ -182,12 +204,15 @@ impl AnyAmbiguousAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m3(&self) -> Option<&MonsterT> { pub fn as_m3(&self) -> Option<&MonsterT> {
if let Self::M3(v) = self { Some(v.as_ref()) } else { None } if let Self::M3(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m3_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m3_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M3(v) = self { Some(v.as_mut()) } else { None } if let Self::M3(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY: u8 = 0; pub const ENUM_MIN_ANY: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY: u8 = 3; pub const ENUM_MAX_ANY: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY: [Any; 4] = [ pub const ENUM_VALUES_ANY: [Any; 4] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_ANY: [Any; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct Any(pub u8); pub struct Any(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Any { impl Any {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -33,6 +37,7 @@ impl Any {
Self::TestSimpleTableWithEnum, Self::TestSimpleTableWithEnum,
Self::MyGame_Example2_Monster, Self::MyGame_Example2_Monster,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -44,6 +49,7 @@ impl Any {
} }
} }
} }
impl ::core::fmt::Debug for Any { impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for Any {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for Any { impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Any {
impl ::flatbuffers::Push for Any { impl ::flatbuffers::Push for Any {
type Output = Any; type Output = Any;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for Any {
impl ::flatbuffers::EndianScalar for Any { impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for Any {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Any {} impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub struct AnyUnionTableOffset {} pub struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum AnyT {
TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>), TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>),
MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>), MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyT { impl Default for AnyT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyT { impl AnyT {
pub fn any_type(&self) -> Any { pub fn any_type(&self) -> Any {
match self { match self {
@@ -119,6 +133,7 @@ impl AnyT {
Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster, Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -127,6 +142,7 @@ impl AnyT {
Self::MyGameExample2Monster(v) => Some(v.pack(fbb).as_union_value()), Self::MyGameExample2Monster(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_monster(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::Monster(_) = self { if let Self::Monster(_) = self {
@@ -140,14 +156,17 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_monster(&self) -> Option<&MonsterT> { pub fn as_monster(&self) -> Option<&MonsterT> {
if let Self::Monster(v) = self { Some(v.as_ref()) } else { None } if let Self::Monster(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_monster_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_monster_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::Monster(v) = self { Some(v.as_mut()) } else { None } if let Self::Monster(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> { pub fn take_test_simple_table_with_enum(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self { if let Self::TestSimpleTableWithEnum(_) = self {
@@ -161,14 +180,17 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
pub fn as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT> { pub fn as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT> {
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_ref()) } else { None } if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
pub fn as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> { pub fn as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None } if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> { pub fn take_my_game_example_2_monster(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self { if let Self::MyGameExample2Monster(_) = self {
@@ -182,12 +204,15 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the super::example_2::MonsterT. /// If the union variant matches, return a reference to the super::example_2::MonsterT.
pub fn as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT> { pub fn as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT> {
if let Self::MyGameExample2Monster(v) = self { Some(v.as_ref()) } else { None } if let Self::MyGameExample2Monster(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the super::example_2::MonsterT. /// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
pub fn as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT> { pub fn as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
if let Self::MyGameExample2Monster(v) = self { Some(v.as_mut()) } else { None } if let Self::MyGameExample2Monster(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0; pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3; pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [ pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct AnyUniqueAliases(pub u8); pub struct AnyUniqueAliases(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl AnyUniqueAliases { impl AnyUniqueAliases {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -33,6 +37,7 @@ impl AnyUniqueAliases {
Self::TS, Self::TS,
Self::M2, Self::M2,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -44,6 +49,7 @@ impl AnyUniqueAliases {
} }
} }
} }
impl ::core::fmt::Debug for AnyUniqueAliases { impl ::core::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for AnyUniqueAliases {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
impl ::flatbuffers::Push for AnyUniqueAliases { impl ::flatbuffers::Push for AnyUniqueAliases {
type Output = AnyUniqueAliases; type Output = AnyUniqueAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for AnyUniqueAliases {
impl ::flatbuffers::EndianScalar for AnyUniqueAliases { impl ::flatbuffers::EndianScalar for AnyUniqueAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyUniqueAliases {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
pub struct AnyUniqueAliasesUnionTableOffset {} pub struct AnyUniqueAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum AnyUniqueAliasesT {
TS(alloc::boxed::Box<TestSimpleTableWithEnumT>), TS(alloc::boxed::Box<TestSimpleTableWithEnumT>),
M2(alloc::boxed::Box<super::example_2::MonsterT>), M2(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyUniqueAliasesT { impl Default for AnyUniqueAliasesT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyUniqueAliasesT { impl AnyUniqueAliasesT {
pub fn any_unique_aliases_type(&self) -> AnyUniqueAliases { pub fn any_unique_aliases_type(&self) -> AnyUniqueAliases {
match self { match self {
@@ -119,6 +133,7 @@ impl AnyUniqueAliasesT {
Self::M2(_) => AnyUniqueAliases::M2, Self::M2(_) => AnyUniqueAliases::M2,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -127,6 +142,7 @@ impl AnyUniqueAliasesT {
Self::M2(v) => Some(v.pack(fbb).as_union_value()), Self::M2(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M(_) = self { if let Self::M(_) = self {
@@ -140,14 +156,17 @@ impl AnyUniqueAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m(&self) -> Option<&MonsterT> { pub fn as_m(&self) -> Option<&MonsterT> {
if let Self::M(v) = self { Some(v.as_ref()) } else { None } if let Self::M(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M(v) = self { Some(v.as_mut()) } else { None } if let Self::M(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> { pub fn take_ts(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self { if let Self::TS(_) = self {
@@ -161,14 +180,17 @@ impl AnyUniqueAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
pub fn as_ts(&self) -> Option<&TestSimpleTableWithEnumT> { pub fn as_ts(&self) -> Option<&TestSimpleTableWithEnumT> {
if let Self::TS(v) = self { Some(v.as_ref()) } else { None } if let Self::TS(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
pub fn as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> { pub fn as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
if let Self::TS(v) = self { Some(v.as_mut()) } else { None } if let Self::TS(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
@@ -182,12 +204,15 @@ impl AnyUniqueAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the super::example_2::MonsterT. /// If the union variant matches, return a reference to the super::example_2::MonsterT.
pub fn as_m2(&self) -> Option<&super::example_2::MonsterT> { pub fn as_m2(&self) -> Option<&super::example_2::MonsterT> {
if let Self::M2(v) = self { Some(v.as_ref()) } else { None } if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the super::example_2::MonsterT. /// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
pub fn as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT> { pub fn as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
if let Self::M2(v) = self { Some(v.as_mut()) } else { None } if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,6 +2,7 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_color { mod bitflags_color {
::flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
@@ -17,10 +18,12 @@ mod bitflags_color {
} }
} }
} }
pub use self::bitflags_color::Color; pub use self::bitflags_color::Color;
impl<'a> ::flatbuffers::Follow<'a> for Color { impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -30,6 +33,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Color {
impl ::flatbuffers::Push for Color { impl ::flatbuffers::Push for Color {
type Output = Color; type Output = Color;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
@@ -38,10 +42,12 @@ impl ::flatbuffers::Push for Color {
impl ::flatbuffers::EndianScalar for Color { impl ::flatbuffers::EndianScalar for Color {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.bits().to_le() self.bits().to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {

View File

@@ -2,6 +2,7 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_long_enum { mod bitflags_long_enum {
::flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
@@ -13,10 +14,12 @@ mod bitflags_long_enum {
} }
} }
} }
pub use self::bitflags_long_enum::LongEnum; pub use self::bitflags_long_enum::LongEnum;
impl<'a> ::flatbuffers::Follow<'a> for LongEnum { impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) };
@@ -26,6 +29,7 @@ impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
impl ::flatbuffers::Push for LongEnum { impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum; type Output = LongEnum;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) }; unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
@@ -34,10 +38,12 @@ impl ::flatbuffers::Push for LongEnum {
impl ::flatbuffers::EndianScalar for LongEnum { impl ::flatbuffers::EndianScalar for LongEnum {
type Scalar = u64; type Scalar = u64;
#[inline] #[inline]
fn to_little_endian(self) -> u64 { fn to_little_endian(self) -> u64 {
self.bits().to_le() self.bits().to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u64) -> Self { fn from_little_endian(v: u64) -> Self {

View File

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

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_RACE: i8 = -1; pub const ENUM_MIN_RACE: i8 = -1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_RACE: i8 = 2; pub const ENUM_MAX_RACE: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_RACE: [Race; 4] = [ pub const ENUM_VALUES_RACE: [Race; 4] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_RACE: [Race; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct Race(pub i8); pub struct Race(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Race { impl Race {
pub const None: Self = Self(-1); pub const None: Self = Self(-1);
@@ -33,6 +37,7 @@ impl Race {
Self::Dwarf, Self::Dwarf,
Self::Elf, Self::Elf,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -44,6 +49,7 @@ impl Race {
} }
} }
} }
impl ::core::fmt::Debug for Race { impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for Race {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for Race { impl<'a> ::flatbuffers::Follow<'a> for Race {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Race {
impl ::flatbuffers::Push for Race { impl ::flatbuffers::Push for Race {
type Output = Race; type Output = Race;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for Race {
impl ::flatbuffers::EndianScalar for Race { impl ::flatbuffers::EndianScalar for Race {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Referrable<'a> { pub struct Referrable<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Referrable<'a> { impl<'a> ::flatbuffers::Follow<'a> for Referrable<'a> {
type Inner = Referrable<'a>; type Inner = Referrable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> Referrable<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Referrable { _tab: table } Referrable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,6 +55,7 @@ impl<'a> Referrable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Referrable) -> bool { pub fn key_compare_less_than(&self, o: &Referrable) -> bool {
self.id() < o.id() self.id() < o.id()
@@ -75,9 +79,11 @@ impl ::flatbuffers::Verifiable for Referrable<'_> {
Ok(()) Ok(())
} }
} }
pub struct ReferrableArgs { pub struct ReferrableArgs {
pub id: u64, pub id: u64,
} }
impl<'a> Default for ReferrableArgs { impl<'a> Default for ReferrableArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -91,11 +97,13 @@ pub struct ReferrableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: u64) { pub fn add_id(&mut self, id: u64) {
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0); self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -104,6 +112,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -118,11 +127,13 @@ impl ::core::fmt::Debug for Referrable<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct ReferrableT { pub struct ReferrableT {
pub id: u64, pub id: u64,
} }
impl Default for ReferrableT { impl Default for ReferrableT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -130,6 +141,7 @@ impl Default for ReferrableT {
} }
} }
} }
impl ReferrableT { impl ReferrableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Stat<'a> { pub struct Stat<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Stat<'a> { impl<'a> ::flatbuffers::Follow<'a> for Stat<'a> {
type Inner = Stat<'a>; type Inner = Stat<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -30,6 +32,7 @@ impl<'a> Stat<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Stat { _tab: table } Stat { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -62,6 +65,7 @@ impl<'a> Stat<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)}
} }
#[inline] #[inline]
pub fn val(&self) -> i64 { pub fn val(&self) -> i64 {
// Safety: // Safety:
@@ -69,6 +73,7 @@ impl<'a> Stat<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn count(&self) -> u16 { pub fn count(&self) -> u16 {
// Safety: // Safety:
@@ -76,6 +81,7 @@ impl<'a> Stat<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()} unsafe { self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Stat) -> bool { pub fn key_compare_less_than(&self, o: &Stat) -> bool {
self.count() < o.count() self.count() < o.count()
@@ -101,11 +107,13 @@ impl ::flatbuffers::Verifiable for Stat<'_> {
Ok(()) Ok(())
} }
} }
pub struct StatArgs<'a> { pub struct StatArgs<'a> {
pub id: Option<::flatbuffers::WIPOffset<&'a str>>, pub id: Option<::flatbuffers::WIPOffset<&'a str>>,
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
impl<'a> Default for StatArgs<'a> { impl<'a> Default for StatArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -121,19 +129,23 @@ pub struct StatBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_id(&mut self, id: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Stat::VT_ID, id); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
} }
#[inline] #[inline]
pub fn add_val(&mut self, val: i64) { pub fn add_val(&mut self, val: i64) {
self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0); self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0);
} }
#[inline] #[inline]
pub fn add_count(&mut self, count: u16) { pub fn add_count(&mut self, count: u16) {
self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0); self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -142,6 +154,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -158,6 +171,7 @@ impl ::core::fmt::Debug for Stat<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct StatT { pub struct StatT {
@@ -165,6 +179,7 @@ pub struct StatT {
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
impl Default for StatT { impl Default for StatT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -174,6 +189,7 @@ impl Default for StatT {
} }
} }
} }
impl StatT { impl StatT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct StructOfStructs, aligned to 4 // struct StructOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct StructOfStructs(pub [u8; 20]); pub struct StructOfStructs(pub [u8; 20]);
impl Default for StructOfStructs { impl Default for StructOfStructs {
fn default() -> Self { fn default() -> Self {
Self([0; 20]) Self([0; 20])
} }
} }
impl ::core::fmt::Debug for StructOfStructs { impl ::core::fmt::Debug for StructOfStructs {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructs") f.debug_struct("StructOfStructs")
@@ -22,27 +25,34 @@ impl ::core::fmt::Debug for StructOfStructs {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructs {}
impl<'a> ::flatbuffers::Follow<'a> for StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for StructOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructs {
type Output = StructOfStructs; type Output = StructOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -127,6 +137,7 @@ pub struct StructOfStructsT {
pub b: TestT, pub b: TestT,
pub c: AbilityT, pub c: AbilityT,
} }
impl StructOfStructsT { impl StructOfStructsT {
pub fn pack(&self) -> StructOfStructs { pub fn pack(&self) -> StructOfStructs {
StructOfStructs::new( StructOfStructs::new(
@@ -136,4 +147,3 @@ impl StructOfStructsT {
) )
} }
} }

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct StructOfStructsOfStructs, aligned to 4 // struct StructOfStructsOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct StructOfStructsOfStructs(pub [u8; 20]); pub struct StructOfStructsOfStructs(pub [u8; 20]);
impl Default for StructOfStructsOfStructs { impl Default for StructOfStructsOfStructs {
fn default() -> Self { fn default() -> Self {
Self([0; 20]) Self([0; 20])
} }
} }
impl ::core::fmt::Debug for StructOfStructsOfStructs { impl ::core::fmt::Debug for StructOfStructsOfStructs {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructsOfStructs") f.debug_struct("StructOfStructsOfStructs")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for StructOfStructsOfStructs {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
impl<'a> ::flatbuffers::Follow<'a> for StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for StructOfStructsOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructsOfStructs {
type Output = StructOfStructsOfStructs; type Output = StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -93,6 +103,7 @@ impl<'a> StructOfStructsOfStructs {
pub struct StructOfStructsOfStructsT { pub struct StructOfStructsOfStructsT {
pub a: StructOfStructsT, pub a: StructOfStructsT,
} }
impl StructOfStructsOfStructsT { impl StructOfStructsOfStructsT {
pub fn pack(&self) -> StructOfStructsOfStructs { pub fn pack(&self) -> StructOfStructsOfStructs {
StructOfStructsOfStructs::new( StructOfStructsOfStructs::new(
@@ -100,4 +111,3 @@ impl StructOfStructsOfStructsT {
) )
} }
} }

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Test, aligned to 2 // struct Test, aligned to 2
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Test(pub [u8; 4]); pub struct Test(pub [u8; 4]);
impl Default for Test { impl Default for Test {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Test { impl ::core::fmt::Debug for Test {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Test") f.debug_struct("Test")
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for Test {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Test {} impl ::flatbuffers::SimpleToVerifyInSlice for Test {}
impl<'a> ::flatbuffers::Follow<'a> for Test { impl<'a> ::flatbuffers::Follow<'a> for Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Test>::follow(buf, loc) } unsafe { <&'a Test>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Test { impl<'a> ::flatbuffers::Follow<'a> for &'a Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Test { impl<'b> ::flatbuffers::Push for Test {
type Output = Test; type Output = Test;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Test as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Test as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(2) ::flatbuffers::PushAlignment::new(2)
@@ -144,6 +154,7 @@ pub struct TestT {
pub a: i16, pub a: i16,
pub b: i8, pub b: i8,
} }
impl TestT { impl TestT {
pub fn pack(&self) -> Test { pub fn pack(&self) -> Test {
Test::new( Test::new(
@@ -152,4 +163,3 @@ impl TestT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TestSimpleTableWithEnum<'a> { pub struct TestSimpleTableWithEnum<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> { impl<'a> ::flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
type Inner = TestSimpleTableWithEnum<'a>; type Inner = TestSimpleTableWithEnum<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TestSimpleTableWithEnum<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TestSimpleTableWithEnum { _tab: table } TestSimpleTableWithEnum { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -65,9 +68,11 @@ impl ::flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
Ok(()) Ok(())
} }
} }
pub struct TestSimpleTableWithEnumArgs { pub struct TestSimpleTableWithEnumArgs {
pub color: Color, pub color: Color,
} }
impl<'a> Default for TestSimpleTableWithEnumArgs { impl<'a> Default for TestSimpleTableWithEnumArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -81,11 +86,13 @@ pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocato
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green); self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -94,6 +101,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilde
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -108,11 +116,13 @@ impl ::core::fmt::Debug for TestSimpleTableWithEnum<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TestSimpleTableWithEnumT { pub struct TestSimpleTableWithEnumT {
pub color: Color, pub color: Color,
} }
impl Default for TestSimpleTableWithEnumT { impl Default for TestSimpleTableWithEnumT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -120,6 +130,7 @@ impl Default for TestSimpleTableWithEnumT {
} }
} }
} }
impl TestSimpleTableWithEnumT { impl TestSimpleTableWithEnumT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TypeAliases<'a> { pub struct TypeAliases<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TypeAliases<'a> { impl<'a> ::flatbuffers::Follow<'a> for TypeAliases<'a> {
type Inner = TypeAliases<'a>; type Inner = TypeAliases<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -39,6 +41,7 @@ impl<'a> TypeAliases<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TypeAliases { _tab: table } TypeAliases { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -100,6 +103,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()} unsafe { self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u8_(&self) -> u8 { pub fn u8_(&self) -> u8 {
// Safety: // Safety:
@@ -107,6 +111,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()} unsafe { self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn i16_(&self) -> i16 { pub fn i16_(&self) -> i16 {
// Safety: // Safety:
@@ -114,6 +119,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()} unsafe { self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u16_(&self) -> u16 { pub fn u16_(&self) -> u16 {
// Safety: // Safety:
@@ -121,6 +127,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()} unsafe { self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn i32_(&self) -> i32 { pub fn i32_(&self) -> i32 {
// Safety: // Safety:
@@ -128,6 +135,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()} unsafe { self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u32_(&self) -> u32 { pub fn u32_(&self) -> u32 {
// Safety: // Safety:
@@ -135,6 +143,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()} unsafe { self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn i64_(&self) -> i64 { pub fn i64_(&self) -> i64 {
// Safety: // Safety:
@@ -142,6 +151,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u64_(&self) -> u64 { pub fn u64_(&self) -> u64 {
// Safety: // Safety:
@@ -149,6 +159,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn f32_(&self) -> f32 { pub fn f32_(&self) -> f32 {
// Safety: // Safety:
@@ -156,6 +167,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()} unsafe { self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn f64_(&self) -> f64 { pub fn f64_(&self) -> f64 {
// Safety: // Safety:
@@ -163,6 +175,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()} unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn v8(&self) -> Option<::flatbuffers::Vector<'a, i8>> { pub fn v8(&self) -> Option<::flatbuffers::Vector<'a, i8>> {
// Safety: // Safety:
@@ -170,6 +183,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)}
} }
#[inline] #[inline]
pub fn vf64(&self) -> Option<::flatbuffers::Vector<'a, f64>> { pub fn vf64(&self) -> Option<::flatbuffers::Vector<'a, f64>> {
// Safety: // Safety:
@@ -201,6 +215,7 @@ impl ::flatbuffers::Verifiable for TypeAliases<'_> {
Ok(()) Ok(())
} }
} }
pub struct TypeAliasesArgs<'a> { pub struct TypeAliasesArgs<'a> {
pub i8_: i8, pub i8_: i8,
pub u8_: u8, pub u8_: u8,
@@ -215,6 +230,7 @@ pub struct TypeAliasesArgs<'a> {
pub v8: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i8>>>, pub v8: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i8>>>,
pub vf64: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f64>>>, pub vf64: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f64>>>,
} }
impl<'a> Default for TypeAliasesArgs<'a> { impl<'a> Default for TypeAliasesArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -239,55 +255,68 @@ pub struct TypeAliasesBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_i8_(&mut self, i8_: i8) { pub fn add_i8_(&mut self, i8_: i8) {
self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0); self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
} }
#[inline] #[inline]
pub fn add_u8_(&mut self, u8_: u8) { pub fn add_u8_(&mut self, u8_: u8) {
self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0); self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0);
} }
#[inline] #[inline]
pub fn add_i16_(&mut self, i16_: i16) { pub fn add_i16_(&mut self, i16_: i16) {
self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0); self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0);
} }
#[inline] #[inline]
pub fn add_u16_(&mut self, u16_: u16) { pub fn add_u16_(&mut self, u16_: u16) {
self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0); self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0);
} }
#[inline] #[inline]
pub fn add_i32_(&mut self, i32_: i32) { pub fn add_i32_(&mut self, i32_: i32) {
self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0); self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0);
} }
#[inline] #[inline]
pub fn add_u32_(&mut self, u32_: u32) { pub fn add_u32_(&mut self, u32_: u32) {
self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0); self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0);
} }
#[inline] #[inline]
pub fn add_i64_(&mut self, i64_: i64) { pub fn add_i64_(&mut self, i64_: i64) {
self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0); self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0);
} }
#[inline] #[inline]
pub fn add_u64_(&mut self, u64_: u64) { pub fn add_u64_(&mut self, u64_: u64) {
self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0); self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0);
} }
#[inline] #[inline]
pub fn add_f32_(&mut self, f32_: f32) { pub fn add_f32_(&mut self, f32_: f32) {
self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0); self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0);
} }
#[inline] #[inline]
pub fn add_f64_(&mut self, f64_: f64) { pub fn add_f64_(&mut self, f64_: f64) {
self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0); self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
} }
#[inline] #[inline]
pub fn add_v8(&mut self, v8: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i8>>) { pub fn add_v8(&mut self, v8: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
} }
#[inline] #[inline]
pub fn add_vf64(&mut self, vf64: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) { pub fn add_vf64(&mut self, vf64: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -296,6 +325,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -321,6 +351,7 @@ impl ::core::fmt::Debug for TypeAliases<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TypeAliasesT { pub struct TypeAliasesT {
@@ -337,6 +368,7 @@ pub struct TypeAliasesT {
pub v8: Option<alloc::vec::Vec<i8>>, pub v8: Option<alloc::vec::Vec<i8>>,
pub vf64: Option<alloc::vec::Vec<f64>>, pub vf64: Option<alloc::vec::Vec<f64>>,
} }
impl Default for TypeAliasesT { impl Default for TypeAliasesT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -355,6 +387,7 @@ impl Default for TypeAliasesT {
} }
} }
} }
impl TypeAliasesT { impl TypeAliasesT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Vec3, aligned to 8 // struct Vec3, aligned to 8
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Vec3(pub [u8; 32]); pub struct Vec3(pub [u8; 32]);
impl Default for Vec3 { impl Default for Vec3 {
fn default() -> Self { fn default() -> Self {
Self([0; 32]) Self([0; 32])
} }
} }
impl ::core::fmt::Debug for Vec3 { impl ::core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Vec3") f.debug_struct("Vec3")
@@ -25,27 +28,34 @@ impl ::core::fmt::Debug for Vec3 {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {} impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {}
impl<'a> ::flatbuffers::Follow<'a> for Vec3 { impl<'a> ::flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Vec3>::follow(buf, loc) } unsafe { <&'a Vec3>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 { impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Vec3 { impl<'b> ::flatbuffers::Push for Vec3 {
type Output = Vec3; type Output = Vec3;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
@@ -263,6 +273,7 @@ pub struct Vec3T {
pub test2: Color, pub test2: Color,
pub test3: TestT, pub test3: TestT,
} }
impl Vec3T { impl Vec3T {
pub fn pack(&self) -> Vec3 { pub fn pack(&self) -> Vec3 {
Vec3::new( Vec3::new(
@@ -275,4 +286,3 @@ impl Vec3T {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
} }
impl<'a> Monster<'a> { impl<'a> Monster<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example2.Monster" "MyGame.Example2.Monster"
} }
@@ -27,6 +28,7 @@ impl<'a> Monster<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
Ok(()) Ok(())
} }
} }
pub struct MonsterArgs { pub struct MonsterArgs {
} }
impl<'a> Default for MonsterArgs { impl<'a> Default for MonsterArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -66,6 +70,7 @@ pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for Monster<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct MonsterT { pub struct MonsterT {
} }
impl Default for MonsterT { impl Default for MonsterT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct InParentNamespace<'a> { pub struct InParentNamespace<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> { impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
type Inner = InParentNamespace<'a>; type Inner = InParentNamespace<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
} }
impl<'a> InParentNamespace<'a> { impl<'a> InParentNamespace<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.InParentNamespace" "MyGame.InParentNamespace"
} }
@@ -27,6 +28,7 @@ impl<'a> InParentNamespace<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
InParentNamespace { _tab: table } InParentNamespace { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for InParentNamespace<'_> {
Ok(()) Ok(())
} }
} }
pub struct InParentNamespaceArgs { pub struct InParentNamespaceArgs {
} }
impl<'a> Default for InParentNamespaceArgs { impl<'a> Default for InParentNamespaceArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -66,6 +70,7 @@ pub struct InParentNamespaceBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for InParentNamespace<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct InParentNamespaceT { pub struct InParentNamespaceT {
} }
impl Default for InParentNamespaceT { impl Default for InParentNamespaceT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl InParentNamespaceT { impl InParentNamespaceT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0; pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
@@ -15,6 +18,7 @@ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct FromInclude(pub i64); pub struct FromInclude(pub i64);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl FromInclude { impl FromInclude {
pub const IncludeVal: Self = Self(0); pub const IncludeVal: Self = Self(0);
@@ -24,6 +28,7 @@ impl FromInclude {
pub const ENUM_VALUES: &'static [Self] = &[ pub const ENUM_VALUES: &'static [Self] = &[
Self::IncludeVal, Self::IncludeVal,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -32,6 +37,7 @@ impl FromInclude {
} }
} }
} }
impl ::core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -41,8 +47,10 @@ impl ::core::fmt::Debug for FromInclude {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
@@ -52,6 +60,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
impl ::flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
@@ -60,10 +69,12 @@ impl ::flatbuffers::Push for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self { fn from_little_endian(v: i64) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableB<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableB<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) { pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableB<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for TableBT {
} }
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]); pub struct Unused(pub [u8; 4]);
impl Default for Unused { impl Default for Unused {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for Unused {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> ::flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -110,6 +120,7 @@ impl<'a> Unused {
pub struct UnusedT { pub struct UnusedT {
pub a: i32, pub a: i32,
} }
impl UnusedT { impl UnusedT {
pub fn pack(&self) -> Unused { pub fn pack(&self) -> Unused {
Unused::new( Unused::new(
@@ -117,4 +128,3 @@ impl UnusedT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for TableAT {
} }
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
// struct Ability, aligned to 4 // struct Ability, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Ability(pub [u8; 8]); pub struct Ability(pub [u8; 8]);
impl Default for Ability { impl Default for Ability {
fn default() -> Self { fn default() -> Self {
Self([0; 8]) Self([0; 8])
} }
} }
impl ::core::fmt::Debug for Ability { impl ::core::fmt::Debug for Ability {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Ability") f.debug_struct("Ability")
@@ -23,27 +26,34 @@ impl ::core::fmt::Debug for Ability {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Ability {} impl ::flatbuffers::SimpleToVerifyInSlice for Ability {}
impl<'a> ::flatbuffers::Follow<'a> for Ability { impl<'a> ::flatbuffers::Follow<'a> for Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Ability>::follow(buf, loc) } unsafe { <&'a Ability>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Ability { impl<'a> ::flatbuffers::Follow<'a> for &'a Ability {
type Inner = &'a Ability; type Inner = &'a Ability;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Ability>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Ability>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Ability { impl<'b> ::flatbuffers::Push for Ability {
type Output = Ability; type Output = Ability;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Ability as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Ability as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -116,6 +126,7 @@ impl<'a> Ability {
} }
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Ability) -> bool { pub fn key_compare_less_than(&self, o: &Ability) -> bool {
self.id() < o.id() self.id() < o.id()
@@ -168,6 +179,7 @@ pub struct AbilityT {
pub id: u32, pub id: u32,
pub distance: u32, pub distance: u32,
} }
impl AbilityT { impl AbilityT {
pub fn pack(&self) -> Ability { pub fn pack(&self) -> Ability {
Ability::new( Ability::new(
@@ -176,4 +188,3 @@ impl AbilityT {
) )
} }
} }

View File

@@ -4,10 +4,13 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0; pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3; pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [ pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
@@ -20,6 +23,7 @@ pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct AnyAmbiguousAliases(pub u8); pub struct AnyAmbiguousAliases(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl AnyAmbiguousAliases { impl AnyAmbiguousAliases {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -35,6 +39,7 @@ impl AnyAmbiguousAliases {
Self::M2, Self::M2,
Self::M3, Self::M3,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -46,6 +51,7 @@ impl AnyAmbiguousAliases {
} }
} }
} }
impl ::core::fmt::Debug for AnyAmbiguousAliases { impl ::core::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for AnyAmbiguousAliases {
} }
} }
} }
impl Serialize for AnyAmbiguousAliases { impl Serialize for AnyAmbiguousAliases {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> for AnyAmbiguousAliases {
impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -94,6 +102,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AnyAmbiguousAliases {
impl ::flatbuffers::Push for AnyAmbiguousAliases { impl ::flatbuffers::Push for AnyAmbiguousAliases {
type Output = AnyAmbiguousAliases; type Output = AnyAmbiguousAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -102,10 +111,12 @@ impl ::flatbuffers::Push for AnyAmbiguousAliases {
impl ::flatbuffers::EndianScalar for AnyAmbiguousAliases { impl ::flatbuffers::EndianScalar for AnyAmbiguousAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -124,6 +135,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyAmbiguousAliases {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyAmbiguousAliases {}
pub struct AnyAmbiguousAliasesUnionTableOffset {} pub struct AnyAmbiguousAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -135,11 +147,13 @@ pub enum AnyAmbiguousAliasesT {
M2(alloc::boxed::Box<MonsterT>), M2(alloc::boxed::Box<MonsterT>),
M3(alloc::boxed::Box<MonsterT>), M3(alloc::boxed::Box<MonsterT>),
} }
impl Default for AnyAmbiguousAliasesT { impl Default for AnyAmbiguousAliasesT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyAmbiguousAliasesT { impl AnyAmbiguousAliasesT {
pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases { pub fn any_ambiguous_aliases_type(&self) -> AnyAmbiguousAliases {
match self { match self {
@@ -149,6 +163,7 @@ impl AnyAmbiguousAliasesT {
Self::M3(_) => AnyAmbiguousAliases::M3, Self::M3(_) => AnyAmbiguousAliases::M3,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -157,6 +172,7 @@ impl AnyAmbiguousAliasesT {
Self::M3(v) => Some(v.pack(fbb).as_union_value()), Self::M3(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m1(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M1(_) = self { if let Self::M1(_) = self {
@@ -170,14 +186,17 @@ impl AnyAmbiguousAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m1(&self) -> Option<&MonsterT> { pub fn as_m1(&self) -> Option<&MonsterT> {
if let Self::M1(v) = self { Some(v.as_ref()) } else { None } if let Self::M1(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m1_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m1_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M1(v) = self { Some(v.as_mut()) } else { None } if let Self::M1(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
@@ -191,14 +210,17 @@ impl AnyAmbiguousAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m2(&self) -> Option<&MonsterT> { pub fn as_m2(&self) -> Option<&MonsterT> {
if let Self::M2(v) = self { Some(v.as_ref()) } else { None } if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m2_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m2_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M2(v) = self { Some(v.as_mut()) } else { None } if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m3(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M3(_) = self { if let Self::M3(_) = self {
@@ -212,12 +234,15 @@ impl AnyAmbiguousAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m3(&self) -> Option<&MonsterT> { pub fn as_m3(&self) -> Option<&MonsterT> {
if let Self::M3(v) = self { Some(v.as_ref()) } else { None } if let Self::M3(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m3_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m3_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M3(v) = self { Some(v.as_mut()) } else { None } if let Self::M3(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -4,10 +4,13 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY: u8 = 0; pub const ENUM_MIN_ANY: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY: u8 = 3; pub const ENUM_MAX_ANY: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY: [Any; 4] = [ pub const ENUM_VALUES_ANY: [Any; 4] = [
@@ -20,6 +23,7 @@ pub const ENUM_VALUES_ANY: [Any; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct Any(pub u8); pub struct Any(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Any { impl Any {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -35,6 +39,7 @@ impl Any {
Self::TestSimpleTableWithEnum, Self::TestSimpleTableWithEnum,
Self::MyGame_Example2_Monster, Self::MyGame_Example2_Monster,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -46,6 +51,7 @@ impl Any {
} }
} }
} }
impl ::core::fmt::Debug for Any { impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for Any {
} }
} }
} }
impl Serialize for Any { impl Serialize for Any {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> for Any {
impl<'a> ::flatbuffers::Follow<'a> for Any { impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -94,6 +102,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Any {
impl ::flatbuffers::Push for Any { impl ::flatbuffers::Push for Any {
type Output = Any; type Output = Any;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -102,10 +111,12 @@ impl ::flatbuffers::Push for Any {
impl ::flatbuffers::EndianScalar for Any { impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -124,6 +135,7 @@ impl<'a> ::flatbuffers::Verifiable for Any {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Any {} impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub struct AnyUnionTableOffset {} pub struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -135,11 +147,13 @@ pub enum AnyT {
TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>), TestSimpleTableWithEnum(alloc::boxed::Box<TestSimpleTableWithEnumT>),
MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>), MyGameExample2Monster(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyT { impl Default for AnyT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyT { impl AnyT {
pub fn any_type(&self) -> Any { pub fn any_type(&self) -> Any {
match self { match self {
@@ -149,6 +163,7 @@ impl AnyT {
Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster, Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -157,6 +172,7 @@ impl AnyT {
Self::MyGameExample2Monster(v) => Some(v.pack(fbb).as_union_value()), Self::MyGameExample2Monster(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_monster(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::Monster(_) = self { if let Self::Monster(_) = self {
@@ -170,14 +186,17 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_monster(&self) -> Option<&MonsterT> { pub fn as_monster(&self) -> Option<&MonsterT> {
if let Self::Monster(v) = self { Some(v.as_ref()) } else { None } if let Self::Monster(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_monster_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_monster_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::Monster(v) = self { Some(v.as_mut()) } else { None } if let Self::Monster(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> { pub fn take_test_simple_table_with_enum(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self { if let Self::TestSimpleTableWithEnum(_) = self {
@@ -191,14 +210,17 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
pub fn as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT> { pub fn as_test_simple_table_with_enum(&self) -> Option<&TestSimpleTableWithEnumT> {
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_ref()) } else { None } if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
pub fn as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> { pub fn as_test_simple_table_with_enum_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None } if let Self::TestSimpleTableWithEnum(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> { pub fn take_my_game_example_2_monster(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self { if let Self::MyGameExample2Monster(_) = self {
@@ -212,12 +234,15 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the super::example_2::MonsterT. /// If the union variant matches, return a reference to the super::example_2::MonsterT.
pub fn as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT> { pub fn as_my_game_example_2_monster(&self) -> Option<&super::example_2::MonsterT> {
if let Self::MyGameExample2Monster(v) = self { Some(v.as_ref()) } else { None } if let Self::MyGameExample2Monster(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the super::example_2::MonsterT. /// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
pub fn as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT> { pub fn as_my_game_example_2_monster_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
if let Self::MyGameExample2Monster(v) = self { Some(v.as_mut()) } else { None } if let Self::MyGameExample2Monster(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -4,10 +4,13 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0; pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3; pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [ pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
@@ -20,6 +23,7 @@ pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct AnyUniqueAliases(pub u8); pub struct AnyUniqueAliases(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl AnyUniqueAliases { impl AnyUniqueAliases {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -35,6 +39,7 @@ impl AnyUniqueAliases {
Self::TS, Self::TS,
Self::M2, Self::M2,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -46,6 +51,7 @@ impl AnyUniqueAliases {
} }
} }
} }
impl ::core::fmt::Debug for AnyUniqueAliases { impl ::core::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for AnyUniqueAliases {
} }
} }
} }
impl Serialize for AnyUniqueAliases { impl Serialize for AnyUniqueAliases {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> for AnyUniqueAliases {
impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases { impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -94,6 +102,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AnyUniqueAliases {
impl ::flatbuffers::Push for AnyUniqueAliases { impl ::flatbuffers::Push for AnyUniqueAliases {
type Output = AnyUniqueAliases; type Output = AnyUniqueAliases;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -102,10 +111,12 @@ impl ::flatbuffers::Push for AnyUniqueAliases {
impl ::flatbuffers::EndianScalar for AnyUniqueAliases { impl ::flatbuffers::EndianScalar for AnyUniqueAliases {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -124,6 +135,7 @@ impl<'a> ::flatbuffers::Verifiable for AnyUniqueAliases {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {} impl ::flatbuffers::SimpleToVerifyInSlice for AnyUniqueAliases {}
pub struct AnyUniqueAliasesUnionTableOffset {} pub struct AnyUniqueAliasesUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -135,11 +147,13 @@ pub enum AnyUniqueAliasesT {
TS(alloc::boxed::Box<TestSimpleTableWithEnumT>), TS(alloc::boxed::Box<TestSimpleTableWithEnumT>),
M2(alloc::boxed::Box<super::example_2::MonsterT>), M2(alloc::boxed::Box<super::example_2::MonsterT>),
} }
impl Default for AnyUniqueAliasesT { impl Default for AnyUniqueAliasesT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyUniqueAliasesT { impl AnyUniqueAliasesT {
pub fn any_unique_aliases_type(&self) -> AnyUniqueAliases { pub fn any_unique_aliases_type(&self) -> AnyUniqueAliases {
match self { match self {
@@ -149,6 +163,7 @@ impl AnyUniqueAliasesT {
Self::M2(_) => AnyUniqueAliases::M2, Self::M2(_) => AnyUniqueAliases::M2,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -157,6 +172,7 @@ impl AnyUniqueAliasesT {
Self::M2(v) => Some(v.pack(fbb).as_union_value()), Self::M2(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned MonsterT, setting the union to NONE. /// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<alloc::boxed::Box<MonsterT>> { pub fn take_m(&mut self) -> Option<alloc::boxed::Box<MonsterT>> {
if let Self::M(_) = self { if let Self::M(_) = self {
@@ -170,14 +186,17 @@ impl AnyUniqueAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the MonsterT. /// If the union variant matches, return a reference to the MonsterT.
pub fn as_m(&self) -> Option<&MonsterT> { pub fn as_m(&self) -> Option<&MonsterT> {
if let Self::M(v) = self { Some(v.as_ref()) } else { None } if let Self::M(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the MonsterT. /// If the union variant matches, return a mutable reference to the MonsterT.
pub fn as_m_mut(&mut self) -> Option<&mut MonsterT> { pub fn as_m_mut(&mut self) -> Option<&mut MonsterT> {
if let Self::M(v) = self { Some(v.as_mut()) } else { None } if let Self::M(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE. /// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> { pub fn take_ts(&mut self) -> Option<alloc::boxed::Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self { if let Self::TS(_) = self {
@@ -191,14 +210,17 @@ impl AnyUniqueAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a reference to the TestSimpleTableWithEnumT.
pub fn as_ts(&self) -> Option<&TestSimpleTableWithEnumT> { pub fn as_ts(&self) -> Option<&TestSimpleTableWithEnumT> {
if let Self::TS(v) = self { Some(v.as_ref()) } else { None } if let Self::TS(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT. /// If the union variant matches, return a mutable reference to the TestSimpleTableWithEnumT.
pub fn as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> { pub fn as_ts_mut(&mut self) -> Option<&mut TestSimpleTableWithEnumT> {
if let Self::TS(v) = self { Some(v.as_mut()) } else { None } if let Self::TS(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE. /// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> { pub fn take_m2(&mut self) -> Option<alloc::boxed::Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self { if let Self::M2(_) = self {
@@ -212,12 +234,15 @@ impl AnyUniqueAliasesT {
None None
} }
} }
/// If the union variant matches, return a reference to the super::example_2::MonsterT. /// If the union variant matches, return a reference to the super::example_2::MonsterT.
pub fn as_m2(&self) -> Option<&super::example_2::MonsterT> { pub fn as_m2(&self) -> Option<&super::example_2::MonsterT> {
if let Self::M2(v) = self { Some(v.as_ref()) } else { None } if let Self::M2(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the super::example_2::MonsterT. /// If the union variant matches, return a mutable reference to the super::example_2::MonsterT.
pub fn as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT> { pub fn as_m2_mut(&mut self) -> Option<&mut super::example_2::MonsterT> {
if let Self::M2(v) = self { Some(v.as_mut()) } else { None } if let Self::M2(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -4,6 +4,7 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_color { mod bitflags_color {
::flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
@@ -19,6 +20,7 @@ mod bitflags_color {
} }
} }
} }
pub use self::bitflags_color::Color; pub use self::bitflags_color::Color;
impl Serialize for Color { impl Serialize for Color {
@@ -32,6 +34,7 @@ impl Serialize for Color {
impl<'a> ::flatbuffers::Follow<'a> for Color { impl<'a> ::flatbuffers::Follow<'a> for Color {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -41,6 +44,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Color {
impl ::flatbuffers::Push for Color { impl ::flatbuffers::Push for Color {
type Output = Color; type Output = Color;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.bits()) };
@@ -49,10 +53,12 @@ impl ::flatbuffers::Push for Color {
impl ::flatbuffers::EndianScalar for Color { impl ::flatbuffers::EndianScalar for Color {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.bits().to_le() self.bits().to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {

View File

@@ -4,6 +4,7 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod bitflags_long_enum { mod bitflags_long_enum {
::flatbuffers::bitflags::bitflags! { ::flatbuffers::bitflags::bitflags! {
@@ -15,6 +16,7 @@ mod bitflags_long_enum {
} }
} }
} }
pub use self::bitflags_long_enum::LongEnum; pub use self::bitflags_long_enum::LongEnum;
impl Serialize for LongEnum { impl Serialize for LongEnum {
@@ -28,6 +30,7 @@ impl Serialize for LongEnum {
impl<'a> ::flatbuffers::Follow<'a> for LongEnum { impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u64>(buf, loc) };
@@ -37,6 +40,7 @@ impl<'a> ::flatbuffers::Follow<'a> for LongEnum {
impl ::flatbuffers::Push for LongEnum { impl ::flatbuffers::Push for LongEnum {
type Output = LongEnum; type Output = LongEnum;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) }; unsafe { ::flatbuffers::emplace_scalar::<u64>(dst, self.bits()) };
@@ -45,10 +49,12 @@ impl ::flatbuffers::Push for LongEnum {
impl ::flatbuffers::EndianScalar for LongEnum { impl ::flatbuffers::EndianScalar for LongEnum {
type Scalar = u64; type Scalar = u64;
#[inline] #[inline]
fn to_little_endian(self) -> u64 { fn to_little_endian(self) -> u64 {
self.bits().to_le() self.bits().to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u64) -> Self { fn from_little_endian(v: u64) -> Self {

View File

@@ -4,16 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum MonsterOffset {} pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
/// an example documentation comment: "monster object" /// an example documentation comment: "monster object"
#[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -91,6 +93,7 @@ impl<'a> Monster<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -396,6 +399,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Vec3>(Monster::VT_POS, None)} unsafe { self._tab.get::<Vec3>(Monster::VT_POS, None)}
} }
#[inline] #[inline]
pub fn mana(&self) -> i16 { pub fn mana(&self) -> i16 {
// Safety: // Safety:
@@ -403,6 +407,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()} unsafe { self._tab.get::<i16>(Monster::VT_MANA, Some(150)).unwrap()}
} }
#[inline] #[inline]
pub fn hp(&self) -> i16 { pub fn hp(&self) -> i16 {
// Safety: // Safety:
@@ -410,6 +415,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()} unsafe { self._tab.get::<i16>(Monster::VT_HP, Some(100)).unwrap()}
} }
#[inline] #[inline]
pub fn name(&self) -> &'a str { pub fn name(&self) -> &'a str {
// Safety: // Safety:
@@ -417,6 +423,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()}
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Monster) -> bool { pub fn key_compare_less_than(&self, o: &Monster) -> bool {
self.name() < o.name() self.name() < o.name()
@@ -427,6 +434,7 @@ impl<'a> Monster<'a> {
let key = self.name(); let key = self.name();
key.cmp(val) key.cmp(val)
} }
#[inline] #[inline]
pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> { pub fn inventory(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety: // Safety:
@@ -434,6 +442,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_INVENTORY, None)}
} }
#[inline] #[inline]
pub fn color(&self) -> Color { pub fn color(&self) -> Color {
// Safety: // Safety:
@@ -441,6 +450,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()} unsafe { self._tab.get::<Color>(Monster::VT_COLOR, Some(Color::Blue)).unwrap()}
} }
#[inline] #[inline]
pub fn test_type(&self) -> Any { pub fn test_type(&self) -> Any {
// Safety: // Safety:
@@ -448,6 +458,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Any>(Monster::VT_TEST_TYPE, Some(Any::NONE)).unwrap()} unsafe { self._tab.get::<Any>(Monster::VT_TEST_TYPE, Some(Any::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn test(&self) -> Option<::flatbuffers::Table<'a>> { pub fn test(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -455,6 +466,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_TEST, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_TEST, None)}
} }
#[inline] #[inline]
pub fn test4(&self) -> Option<::flatbuffers::Vector<'a, Test>> { pub fn test4(&self) -> Option<::flatbuffers::Vector<'a, Test>> {
// Safety: // Safety:
@@ -462,6 +474,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST4, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST4, None)}
} }
#[inline] #[inline]
pub fn testarrayofstring(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> { pub fn testarrayofstring(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> {
// Safety: // Safety:
@@ -469,6 +482,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING, None)}
} }
/// an example documentation comment: this will end up in the generated code /// an example documentation comment: this will end up in the generated code
/// multiline too /// multiline too
#[inline] #[inline]
@@ -478,6 +492,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Monster>>>>(Monster::VT_TESTARRAYOFTABLES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Monster>>>>(Monster::VT_TESTARRAYOFTABLES, None)}
} }
#[inline] #[inline]
pub fn enemy(&self) -> Option<Monster<'a>> { pub fn enemy(&self) -> Option<Monster<'a>> {
// Safety: // Safety:
@@ -485,6 +500,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<Monster>>(Monster::VT_ENEMY, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<Monster>>(Monster::VT_ENEMY, None)}
} }
#[inline] #[inline]
pub fn testnestedflatbuffer(&self) -> Option<::flatbuffers::Vector<'a, u8>> { pub fn testnestedflatbuffer(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety: // Safety:
@@ -492,6 +508,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None)}
} }
pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> { pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
self.testnestedflatbuffer().map(|data| { self.testnestedflatbuffer().map(|data| {
use ::flatbuffers::Follow; use ::flatbuffers::Follow;
@@ -501,6 +518,7 @@ impl<'a> Monster<'a> {
unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) } unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) }
}) })
} }
#[inline] #[inline]
pub fn testempty(&self) -> Option<Stat<'a>> { pub fn testempty(&self) -> Option<Stat<'a>> {
// Safety: // Safety:
@@ -508,6 +526,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<Stat>>(Monster::VT_TESTEMPTY, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<Stat>>(Monster::VT_TESTEMPTY, None)}
} }
#[inline] #[inline]
pub fn testbool(&self) -> bool { pub fn testbool(&self) -> bool {
// Safety: // Safety:
@@ -515,6 +534,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<bool>(Monster::VT_TESTBOOL, Some(false)).unwrap()} unsafe { self._tab.get::<bool>(Monster::VT_TESTBOOL, Some(false)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashs32_fnv1(&self) -> i32 { pub fn testhashs32_fnv1(&self) -> i32 {
// Safety: // Safety:
@@ -522,6 +542,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1, Some(0)).unwrap()} unsafe { self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashu32_fnv1(&self) -> u32 { pub fn testhashu32_fnv1(&self) -> u32 {
// Safety: // Safety:
@@ -529,6 +550,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1, Some(0)).unwrap()} unsafe { self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashs64_fnv1(&self) -> i64 { pub fn testhashs64_fnv1(&self) -> i64 {
// Safety: // Safety:
@@ -536,6 +558,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashu64_fnv1(&self) -> u64 { pub fn testhashu64_fnv1(&self) -> u64 {
// Safety: // Safety:
@@ -543,6 +566,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashs32_fnv1a(&self) -> i32 { pub fn testhashs32_fnv1a(&self) -> i32 {
// Safety: // Safety:
@@ -550,6 +574,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1A, Some(0)).unwrap()} unsafe { self._tab.get::<i32>(Monster::VT_TESTHASHS32_FNV1A, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashu32_fnv1a(&self) -> u32 { pub fn testhashu32_fnv1a(&self) -> u32 {
// Safety: // Safety:
@@ -557,6 +582,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1A, Some(0)).unwrap()} unsafe { self._tab.get::<u32>(Monster::VT_TESTHASHU32_FNV1A, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashs64_fnv1a(&self) -> i64 { pub fn testhashs64_fnv1a(&self) -> i64 {
// Safety: // Safety:
@@ -564,6 +590,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1A, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(Monster::VT_TESTHASHS64_FNV1A, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testhashu64_fnv1a(&self) -> u64 { pub fn testhashu64_fnv1a(&self) -> u64 {
// Safety: // Safety:
@@ -571,6 +598,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1A, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Monster::VT_TESTHASHU64_FNV1A, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn testarrayofbools(&self) -> Option<::flatbuffers::Vector<'a, bool>> { pub fn testarrayofbools(&self) -> Option<::flatbuffers::Vector<'a, bool>> {
// Safety: // Safety:
@@ -578,6 +606,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, bool>>>(Monster::VT_TESTARRAYOFBOOLS, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, bool>>>(Monster::VT_TESTARRAYOFBOOLS, None)}
} }
#[inline] #[inline]
pub fn testf(&self) -> f32 { pub fn testf(&self) -> f32 {
// Safety: // Safety:
@@ -585,6 +614,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_TESTF, Some(3.14159)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_TESTF, Some(3.14159)).unwrap()}
} }
#[inline] #[inline]
pub fn testf2(&self) -> f32 { pub fn testf2(&self) -> f32 {
// Safety: // Safety:
@@ -592,6 +622,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_TESTF2, Some(3.0)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_TESTF2, Some(3.0)).unwrap()}
} }
#[inline] #[inline]
pub fn testf3(&self) -> f32 { pub fn testf3(&self) -> f32 {
// Safety: // Safety:
@@ -599,6 +630,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_TESTF3, Some(0.0)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_TESTF3, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn testarrayofstring2(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> { pub fn testarrayofstring2(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> {
// Safety: // Safety:
@@ -606,6 +638,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING2, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(Monster::VT_TESTARRAYOFSTRING2, None)}
} }
#[inline] #[inline]
pub fn testarrayofsortedstruct(&self) -> Option<::flatbuffers::Vector<'a, Ability>> { pub fn testarrayofsortedstruct(&self) -> Option<::flatbuffers::Vector<'a, Ability>> {
// Safety: // Safety:
@@ -613,6 +646,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Ability>>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Ability>>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, None)}
} }
#[inline] #[inline]
pub fn flex(&self) -> Option<::flatbuffers::Vector<'a, u8>> { pub fn flex(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety: // Safety:
@@ -620,6 +654,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_FLEX, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_FLEX, None)}
} }
#[inline] #[inline]
pub fn test5(&self) -> Option<::flatbuffers::Vector<'a, Test>> { pub fn test5(&self) -> Option<::flatbuffers::Vector<'a, Test>> {
// Safety: // Safety:
@@ -627,6 +662,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST5, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Test>>>(Monster::VT_TEST5, None)}
} }
#[inline] #[inline]
pub fn vector_of_longs(&self) -> Option<::flatbuffers::Vector<'a, i64>> { pub fn vector_of_longs(&self) -> Option<::flatbuffers::Vector<'a, i64>> {
// Safety: // Safety:
@@ -634,6 +670,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i64>>>(Monster::VT_VECTOR_OF_LONGS, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i64>>>(Monster::VT_VECTOR_OF_LONGS, None)}
} }
#[inline] #[inline]
pub fn vector_of_doubles(&self) -> Option<::flatbuffers::Vector<'a, f64>> { pub fn vector_of_doubles(&self) -> Option<::flatbuffers::Vector<'a, f64>> {
// Safety: // Safety:
@@ -641,6 +678,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f64>>>(Monster::VT_VECTOR_OF_DOUBLES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f64>>>(Monster::VT_VECTOR_OF_DOUBLES, None)}
} }
#[inline] #[inline]
pub fn parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>> { pub fn parent_namespace_test(&self) -> Option<super::InParentNamespace<'a>> {
// Safety: // Safety:
@@ -648,6 +686,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, None)}
} }
#[inline] #[inline]
pub fn vector_of_referrables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable<'a>>>> { pub fn vector_of_referrables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
// Safety: // Safety:
@@ -655,6 +694,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None)}
} }
#[inline] #[inline]
pub fn single_weak_reference(&self) -> u64 { pub fn single_weak_reference(&self) -> u64 {
// Safety: // Safety:
@@ -662,6 +702,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn vector_of_weak_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> { pub fn vector_of_weak_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
// Safety: // Safety:
@@ -669,6 +710,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None)}
} }
#[inline] #[inline]
pub fn vector_of_strong_referrables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable<'a>>>> { pub fn vector_of_strong_referrables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable<'a>>>> {
// Safety: // Safety:
@@ -676,6 +718,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Referrable>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None)}
} }
#[inline] #[inline]
pub fn co_owning_reference(&self) -> u64 { pub fn co_owning_reference(&self) -> u64 {
// Safety: // Safety:
@@ -683,6 +726,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_CO_OWNING_REFERENCE, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Monster::VT_CO_OWNING_REFERENCE, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn vector_of_co_owning_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> { pub fn vector_of_co_owning_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
// Safety: // Safety:
@@ -690,6 +734,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, None)}
} }
#[inline] #[inline]
pub fn non_owning_reference(&self) -> u64 { pub fn non_owning_reference(&self) -> u64 {
// Safety: // Safety:
@@ -697,6 +742,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Monster::VT_NON_OWNING_REFERENCE, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Monster::VT_NON_OWNING_REFERENCE, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn vector_of_non_owning_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> { pub fn vector_of_non_owning_references(&self) -> Option<::flatbuffers::Vector<'a, u64>> {
// Safety: // Safety:
@@ -704,6 +750,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)}
} }
#[inline] #[inline]
pub fn any_unique_type(&self) -> AnyUniqueAliases { pub fn any_unique_type(&self) -> AnyUniqueAliases {
// Safety: // Safety:
@@ -711,6 +758,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()} unsafe { self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn any_unique(&self) -> Option<::flatbuffers::Table<'a>> { pub fn any_unique(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -718,6 +766,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)}
} }
#[inline] #[inline]
pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases { pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases {
// Safety: // Safety:
@@ -725,6 +774,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()} unsafe { self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn any_ambiguous(&self) -> Option<::flatbuffers::Table<'a>> { pub fn any_ambiguous(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -732,6 +782,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)}
} }
#[inline] #[inline]
pub fn vector_of_enums(&self) -> Option<::flatbuffers::Vector<'a, Color>> { pub fn vector_of_enums(&self) -> Option<::flatbuffers::Vector<'a, Color>> {
// Safety: // Safety:
@@ -739,6 +790,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)}
} }
#[inline] #[inline]
pub fn signed_enum(&self) -> Race { pub fn signed_enum(&self) -> Race {
// Safety: // Safety:
@@ -746,6 +798,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Race>(Monster::VT_SIGNED_ENUM, Some(Race::None)).unwrap()} unsafe { self._tab.get::<Race>(Monster::VT_SIGNED_ENUM, Some(Race::None)).unwrap()}
} }
#[inline] #[inline]
pub fn testrequirednestedflatbuffer(&self) -> Option<::flatbuffers::Vector<'a, u8>> { pub fn testrequirednestedflatbuffer(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
// Safety: // Safety:
@@ -753,6 +806,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, None)}
} }
pub fn testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> { pub fn testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
self.testrequirednestedflatbuffer().map(|data| { self.testrequirednestedflatbuffer().map(|data| {
use ::flatbuffers::Follow; use ::flatbuffers::Follow;
@@ -762,6 +816,7 @@ impl<'a> Monster<'a> {
unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) } unsafe { <::flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data.bytes(), 0) }
}) })
} }
#[inline] #[inline]
pub fn scalar_key_sorted_tables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Stat<'a>>>> { pub fn scalar_key_sorted_tables(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Stat<'a>>>> {
// Safety: // Safety:
@@ -769,6 +824,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Stat>>>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<Stat>>>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, None)}
} }
#[inline] #[inline]
pub fn native_inline(&self) -> Option<&'a Test> { pub fn native_inline(&self) -> Option<&'a Test> {
// Safety: // Safety:
@@ -776,6 +832,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<Test>(Monster::VT_NATIVE_INLINE, None)} unsafe { self._tab.get::<Test>(Monster::VT_NATIVE_INLINE, None)}
} }
#[inline] #[inline]
pub fn long_enum_non_enum_default(&self) -> LongEnum { pub fn long_enum_non_enum_default(&self) -> LongEnum {
// Safety: // Safety:
@@ -783,6 +840,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, Some(Default::default())).unwrap()} unsafe { self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn long_enum_normal_default(&self) -> LongEnum { pub fn long_enum_normal_default(&self) -> LongEnum {
// Safety: // Safety:
@@ -790,6 +848,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, Some(LongEnum::LongOne)).unwrap()} unsafe { self._tab.get::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, Some(LongEnum::LongOne)).unwrap()}
} }
#[inline] #[inline]
pub fn nan_default(&self) -> f32 { pub fn nan_default(&self) -> f32 {
// Safety: // Safety:
@@ -797,6 +856,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_NAN_DEFAULT, Some(f32::NAN)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_NAN_DEFAULT, Some(f32::NAN)).unwrap()}
} }
#[inline] #[inline]
pub fn inf_default(&self) -> f32 { pub fn inf_default(&self) -> f32 {
// Safety: // Safety:
@@ -804,6 +864,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_INF_DEFAULT, Some(f32::INFINITY)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_INF_DEFAULT, Some(f32::INFINITY)).unwrap()}
} }
#[inline] #[inline]
pub fn positive_inf_default(&self) -> f32 { pub fn positive_inf_default(&self) -> f32 {
// Safety: // Safety:
@@ -811,6 +872,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_POSITIVE_INF_DEFAULT, Some(f32::INFINITY)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_POSITIVE_INF_DEFAULT, Some(f32::INFINITY)).unwrap()}
} }
#[inline] #[inline]
pub fn infinity_default(&self) -> f32 { pub fn infinity_default(&self) -> f32 {
// Safety: // Safety:
@@ -818,6 +880,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_INFINITY_DEFAULT, Some(f32::INFINITY)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_INFINITY_DEFAULT, Some(f32::INFINITY)).unwrap()}
} }
#[inline] #[inline]
pub fn positive_infinity_default(&self) -> f32 { pub fn positive_infinity_default(&self) -> f32 {
// Safety: // Safety:
@@ -825,6 +888,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_POSITIVE_INFINITY_DEFAULT, Some(f32::INFINITY)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_POSITIVE_INFINITY_DEFAULT, Some(f32::INFINITY)).unwrap()}
} }
#[inline] #[inline]
pub fn negative_inf_default(&self) -> f32 { pub fn negative_inf_default(&self) -> f32 {
// Safety: // Safety:
@@ -832,6 +896,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_NEGATIVE_INF_DEFAULT, Some(f32::NEG_INFINITY)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_NEGATIVE_INF_DEFAULT, Some(f32::NEG_INFINITY)).unwrap()}
} }
#[inline] #[inline]
pub fn negative_infinity_default(&self) -> f32 { pub fn negative_infinity_default(&self) -> f32 {
// Safety: // Safety:
@@ -839,6 +904,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(Monster::VT_NEGATIVE_INFINITY_DEFAULT, Some(f32::NEG_INFINITY)).unwrap()} unsafe { self._tab.get::<f32>(Monster::VT_NEGATIVE_INFINITY_DEFAULT, Some(f32::NEG_INFINITY)).unwrap()}
} }
#[inline] #[inline]
pub fn double_inf_default(&self) -> f64 { pub fn double_inf_default(&self) -> f64 {
// Safety: // Safety:
@@ -846,6 +912,7 @@ impl<'a> Monster<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(Monster::VT_DOUBLE_INF_DEFAULT, Some(f64::INFINITY)).unwrap()} unsafe { self._tab.get::<f64>(Monster::VT_DOUBLE_INF_DEFAULT, Some(f64::INFINITY)).unwrap()}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn test_as_monster(&self) -> Option<Monster<'a>> { pub fn test_as_monster(&self) -> Option<Monster<'a>> {
@@ -980,7 +1047,6 @@ impl<'a> Monster<'a> {
None None
} }
} }
} }
impl ::flatbuffers::Verifiable for Monster<'_> { impl ::flatbuffers::Verifiable for Monster<'_> {
@@ -1072,6 +1138,7 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
Ok(()) Ok(())
} }
} }
pub struct MonsterArgs<'a> { pub struct MonsterArgs<'a> {
pub pos: Option<&'a Vec3>, pub pos: Option<&'a Vec3>,
pub mana: i16, pub mana: i16,
@@ -1135,6 +1202,7 @@ pub struct MonsterArgs<'a> {
pub negative_infinity_default: f32, pub negative_infinity_default: f32,
pub double_inf_default: f64, pub double_inf_default: f64,
} }
impl<'a> Default for MonsterArgs<'a> { impl<'a> Default for MonsterArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -1433,251 +1501,313 @@ pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_pos(&mut self, pos: &Vec3) { pub fn add_pos(&mut self, pos: &Vec3) {
self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos); self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
} }
#[inline] #[inline]
pub fn add_mana(&mut self, mana: i16) { pub fn add_mana(&mut self, mana: i16) {
self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150); self.fbb_.push_slot::<i16>(Monster::VT_MANA, mana, 150);
} }
#[inline] #[inline]
pub fn add_hp(&mut self, hp: i16) { pub fn add_hp(&mut self, hp: i16) {
self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100); self.fbb_.push_slot::<i16>(Monster::VT_HP, hp, 100);
} }
#[inline] #[inline]
pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_name(&mut self, name: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_NAME, name);
} }
#[inline] #[inline]
pub fn add_inventory(&mut self, inventory: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) { pub fn add_inventory(&mut self, inventory: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_INVENTORY, inventory);
} }
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue); self.fbb_.push_slot::<Color>(Monster::VT_COLOR, color, Color::Blue);
} }
#[inline] #[inline]
pub fn add_test_type(&mut self, test_type: Any) { pub fn add_test_type(&mut self, test_type: Any) {
self.fbb_.push_slot::<Any>(Monster::VT_TEST_TYPE, test_type, Any::NONE); self.fbb_.push_slot::<Any>(Monster::VT_TEST_TYPE, test_type, Any::NONE);
} }
#[inline] #[inline]
pub fn add_test(&mut self, test: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_test(&mut self, test: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST, test); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST, test);
} }
#[inline] #[inline]
pub fn add_test4(&mut self, test4: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Test>>) { pub fn add_test4(&mut self, test4: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Test>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST4, test4); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST4, test4);
} }
#[inline] #[inline]
pub fn add_testarrayofstring(&mut self, testarrayofstring: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b str>>>) { pub fn add_testarrayofstring(&mut self, testarrayofstring: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b str>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING, testarrayofstring); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
} }
#[inline] #[inline]
pub fn add_testarrayoftables(&mut self, testarrayoftables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Monster<'b >>>>) { pub fn add_testarrayoftables(&mut self, testarrayoftables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Monster<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFTABLES, testarrayoftables); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
} }
#[inline] #[inline]
pub fn add_enemy(&mut self, enemy: ::flatbuffers::WIPOffset<Monster<'b >>) { pub fn add_enemy(&mut self, enemy: ::flatbuffers::WIPOffset<Monster<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<Monster>>(Monster::VT_ENEMY, enemy); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<Monster>>(Monster::VT_ENEMY, enemy);
} }
#[inline] #[inline]
pub fn add_testnestedflatbuffer(&mut self, testnestedflatbuffer: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) { pub fn add_testnestedflatbuffer(&mut self, testnestedflatbuffer: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
} }
#[inline] #[inline]
pub fn add_testempty(&mut self, testempty: ::flatbuffers::WIPOffset<Stat<'b >>) { pub fn add_testempty(&mut self, testempty: ::flatbuffers::WIPOffset<Stat<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<Stat>>(Monster::VT_TESTEMPTY, testempty); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<Stat>>(Monster::VT_TESTEMPTY, testempty);
} }
#[inline] #[inline]
pub fn add_testbool(&mut self, testbool: bool) { pub fn add_testbool(&mut self, testbool: bool) {
self.fbb_.push_slot::<bool>(Monster::VT_TESTBOOL, testbool, false); self.fbb_.push_slot::<bool>(Monster::VT_TESTBOOL, testbool, false);
} }
#[inline] #[inline]
pub fn add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32) { pub fn add_testhashs32_fnv1(&mut self, testhashs32_fnv1: i32) {
self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0); self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
} }
#[inline] #[inline]
pub fn add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32) { pub fn add_testhashu32_fnv1(&mut self, testhashu32_fnv1: u32) {
self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0); self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
} }
#[inline] #[inline]
pub fn add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64) { pub fn add_testhashs64_fnv1(&mut self, testhashs64_fnv1: i64) {
self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0); self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
} }
#[inline] #[inline]
pub fn add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64) { pub fn add_testhashu64_fnv1(&mut self, testhashu64_fnv1: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0); self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
} }
#[inline] #[inline]
pub fn add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32) { pub fn add_testhashs32_fnv1a(&mut self, testhashs32_fnv1a: i32) {
self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0); self.fbb_.push_slot::<i32>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
} }
#[inline] #[inline]
pub fn add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32) { pub fn add_testhashu32_fnv1a(&mut self, testhashu32_fnv1a: u32) {
self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0); self.fbb_.push_slot::<u32>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
} }
#[inline] #[inline]
pub fn add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64) { pub fn add_testhashs64_fnv1a(&mut self, testhashs64_fnv1a: i64) {
self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0); self.fbb_.push_slot::<i64>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
} }
#[inline] #[inline]
pub fn add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64) { pub fn add_testhashu64_fnv1a(&mut self, testhashu64_fnv1a: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0); self.fbb_.push_slot::<u64>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
} }
#[inline] #[inline]
pub fn add_testarrayofbools(&mut self, testarrayofbools: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , bool>>) { pub fn add_testarrayofbools(&mut self, testarrayofbools: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , bool>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
} }
#[inline] #[inline]
pub fn add_testf(&mut self, testf: f32) { pub fn add_testf(&mut self, testf: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_TESTF, testf, 3.14159); self.fbb_.push_slot::<f32>(Monster::VT_TESTF, testf, 3.14159);
} }
#[inline] #[inline]
pub fn add_testf2(&mut self, testf2: f32) { pub fn add_testf2(&mut self, testf2: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_TESTF2, testf2, 3.0); self.fbb_.push_slot::<f32>(Monster::VT_TESTF2, testf2, 3.0);
} }
#[inline] #[inline]
pub fn add_testf3(&mut self, testf3: f32) { pub fn add_testf3(&mut self, testf3: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_TESTF3, testf3, 0.0); self.fbb_.push_slot::<f32>(Monster::VT_TESTF3, testf3, 0.0);
} }
#[inline] #[inline]
pub fn add_testarrayofstring2(&mut self, testarrayofstring2: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b str>>>) { pub fn add_testarrayofstring2(&mut self, testarrayofstring2: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b str>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
} }
#[inline] #[inline]
pub fn add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Ability>>) { pub fn add_testarrayofsortedstruct(&mut self, testarrayofsortedstruct: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Ability>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
} }
#[inline] #[inline]
pub fn add_flex(&mut self, flex: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) { pub fn add_flex(&mut self, flex: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_FLEX, flex); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_FLEX, flex);
} }
#[inline] #[inline]
pub fn add_test5(&mut self, test5: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Test>>) { pub fn add_test5(&mut self, test5: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Test>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST5, test5); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TEST5, test5);
} }
#[inline] #[inline]
pub fn add_vector_of_longs(&mut self, vector_of_longs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i64>>) { pub fn add_vector_of_longs(&mut self, vector_of_longs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_LONGS, vector_of_longs); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
} }
#[inline] #[inline]
pub fn add_vector_of_doubles(&mut self, vector_of_doubles: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) { pub fn add_vector_of_doubles(&mut self, vector_of_doubles: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
} }
#[inline] #[inline]
pub fn add_parent_namespace_test(&mut self, parent_namespace_test: ::flatbuffers::WIPOffset<super::InParentNamespace<'b >>) { pub fn add_parent_namespace_test(&mut self, parent_namespace_test: ::flatbuffers::WIPOffset<super::InParentNamespace<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::InParentNamespace>>(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
} }
#[inline] #[inline]
pub fn add_vector_of_referrables(&mut self, vector_of_referrables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Referrable<'b >>>>) { pub fn add_vector_of_referrables(&mut self, vector_of_referrables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
} }
#[inline] #[inline]
pub fn add_single_weak_reference(&mut self, single_weak_reference: u64) { pub fn add_single_weak_reference(&mut self, single_weak_reference: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0); self.fbb_.push_slot::<u64>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
} }
#[inline] #[inline]
pub fn add_vector_of_weak_references(&mut self, vector_of_weak_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) { pub fn add_vector_of_weak_references(&mut self, vector_of_weak_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
} }
#[inline] #[inline]
pub fn add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Referrable<'b >>>>) { pub fn add_vector_of_strong_referrables(&mut self, vector_of_strong_referrables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Referrable<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
} }
#[inline] #[inline]
pub fn add_co_owning_reference(&mut self, co_owning_reference: u64) { pub fn add_co_owning_reference(&mut self, co_owning_reference: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0); self.fbb_.push_slot::<u64>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
} }
#[inline] #[inline]
pub fn add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) { pub fn add_vector_of_co_owning_references(&mut self, vector_of_co_owning_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
} }
#[inline] #[inline]
pub fn add_non_owning_reference(&mut self, non_owning_reference: u64) { pub fn add_non_owning_reference(&mut self, non_owning_reference: u64) {
self.fbb_.push_slot::<u64>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0); self.fbb_.push_slot::<u64>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
} }
#[inline] #[inline]
pub fn add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) { pub fn add_vector_of_non_owning_references(&mut self, vector_of_non_owning_references: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
} }
#[inline] #[inline]
pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) { pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) {
self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE); self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE);
} }
#[inline] #[inline]
pub fn add_any_unique(&mut self, any_unique: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_any_unique(&mut self, any_unique: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique);
} }
#[inline] #[inline]
pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) { pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) {
self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE); self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE);
} }
#[inline] #[inline]
pub fn add_any_ambiguous(&mut self, any_ambiguous: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_any_ambiguous(&mut self, any_ambiguous: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
} }
#[inline] #[inline]
pub fn add_vector_of_enums(&mut self, vector_of_enums: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Color>>) { pub fn add_vector_of_enums(&mut self, vector_of_enums: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , Color>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
} }
#[inline] #[inline]
pub fn add_signed_enum(&mut self, signed_enum: Race) { pub fn add_signed_enum(&mut self, signed_enum: Race) {
self.fbb_.push_slot::<Race>(Monster::VT_SIGNED_ENUM, signed_enum, Race::None); self.fbb_.push_slot::<Race>(Monster::VT_SIGNED_ENUM, signed_enum, Race::None);
} }
#[inline] #[inline]
pub fn add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) { pub fn add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
} }
#[inline] #[inline]
pub fn add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Stat<'b >>>>) { pub fn add_scalar_key_sorted_tables(&mut self, scalar_key_sorted_tables: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<Stat<'b >>>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
} }
#[inline] #[inline]
pub fn add_native_inline(&mut self, native_inline: &Test) { pub fn add_native_inline(&mut self, native_inline: &Test) {
self.fbb_.push_slot_always::<&Test>(Monster::VT_NATIVE_INLINE, native_inline); self.fbb_.push_slot_always::<&Test>(Monster::VT_NATIVE_INLINE, native_inline);
} }
#[inline] #[inline]
pub fn add_long_enum_non_enum_default(&mut self, long_enum_non_enum_default: LongEnum) { pub fn add_long_enum_non_enum_default(&mut self, long_enum_non_enum_default: LongEnum) {
self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, long_enum_non_enum_default, Default::default()); self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, long_enum_non_enum_default, Default::default());
} }
#[inline] #[inline]
pub fn add_long_enum_normal_default(&mut self, long_enum_normal_default: LongEnum) { pub fn add_long_enum_normal_default(&mut self, long_enum_normal_default: LongEnum) {
self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, long_enum_normal_default, LongEnum::LongOne); self.fbb_.push_slot::<LongEnum>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, long_enum_normal_default, LongEnum::LongOne);
} }
#[inline] #[inline]
pub fn add_nan_default(&mut self, nan_default: f32) { pub fn add_nan_default(&mut self, nan_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_NAN_DEFAULT, nan_default, f32::NAN); self.fbb_.push_slot::<f32>(Monster::VT_NAN_DEFAULT, nan_default, f32::NAN);
} }
#[inline] #[inline]
pub fn add_inf_default(&mut self, inf_default: f32) { pub fn add_inf_default(&mut self, inf_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_INF_DEFAULT, inf_default, f32::INFINITY); self.fbb_.push_slot::<f32>(Monster::VT_INF_DEFAULT, inf_default, f32::INFINITY);
} }
#[inline] #[inline]
pub fn add_positive_inf_default(&mut self, positive_inf_default: f32) { pub fn add_positive_inf_default(&mut self, positive_inf_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_POSITIVE_INF_DEFAULT, positive_inf_default, f32::INFINITY); self.fbb_.push_slot::<f32>(Monster::VT_POSITIVE_INF_DEFAULT, positive_inf_default, f32::INFINITY);
} }
#[inline] #[inline]
pub fn add_infinity_default(&mut self, infinity_default: f32) { pub fn add_infinity_default(&mut self, infinity_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_INFINITY_DEFAULT, infinity_default, f32::INFINITY); self.fbb_.push_slot::<f32>(Monster::VT_INFINITY_DEFAULT, infinity_default, f32::INFINITY);
} }
#[inline] #[inline]
pub fn add_positive_infinity_default(&mut self, positive_infinity_default: f32) { pub fn add_positive_infinity_default(&mut self, positive_infinity_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_POSITIVE_INFINITY_DEFAULT, positive_infinity_default, f32::INFINITY); self.fbb_.push_slot::<f32>(Monster::VT_POSITIVE_INFINITY_DEFAULT, positive_infinity_default, f32::INFINITY);
} }
#[inline] #[inline]
pub fn add_negative_inf_default(&mut self, negative_inf_default: f32) { pub fn add_negative_inf_default(&mut self, negative_inf_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_NEGATIVE_INF_DEFAULT, negative_inf_default, f32::NEG_INFINITY); self.fbb_.push_slot::<f32>(Monster::VT_NEGATIVE_INF_DEFAULT, negative_inf_default, f32::NEG_INFINITY);
} }
#[inline] #[inline]
pub fn add_negative_infinity_default(&mut self, negative_infinity_default: f32) { pub fn add_negative_infinity_default(&mut self, negative_infinity_default: f32) {
self.fbb_.push_slot::<f32>(Monster::VT_NEGATIVE_INFINITY_DEFAULT, negative_infinity_default, f32::NEG_INFINITY); self.fbb_.push_slot::<f32>(Monster::VT_NEGATIVE_INFINITY_DEFAULT, negative_infinity_default, f32::NEG_INFINITY);
} }
#[inline] #[inline]
pub fn add_double_inf_default(&mut self, double_inf_default: f64) { pub fn add_double_inf_default(&mut self, double_inf_default: f64) {
self.fbb_.push_slot::<f64>(Monster::VT_DOUBLE_INF_DEFAULT, double_inf_default, f64::INFINITY); self.fbb_.push_slot::<f64>(Monster::VT_DOUBLE_INF_DEFAULT, double_inf_default, f64::INFINITY);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -1686,6 +1816,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -1839,6 +1970,7 @@ impl ::core::fmt::Debug for Monster<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct MonsterT { pub struct MonsterT {
@@ -1901,6 +2033,7 @@ pub struct MonsterT {
pub negative_infinity_default: f32, pub negative_infinity_default: f32,
pub double_inf_default: f64, pub double_inf_default: f64,
} }
impl Default for MonsterT { impl Default for MonsterT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -1965,6 +2098,7 @@ impl Default for MonsterT {
} }
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
@@ -2147,66 +2281,73 @@ impl MonsterT {
}) })
} }
} }
#[inline]
/// Verifies that a buffer of bytes contains a `Monster` /// Verifies that a buffer of bytes contains a `Monster`
/// and returns it. /// and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
#[inline]
pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<Monster>(buf) ::flatbuffers::root::<Monster>(buf)
} }
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
/// `Monster` and returns it. /// `Monster` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_monster_unchecked`. /// `size_prefixed_root_as_monster_unchecked`.
#[inline]
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<Monster>(buf) ::flatbuffers::size_prefixed_root::<Monster>(buf)
} }
#[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
/// contains a `Monster` and returns it. /// contains a `Monster` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
#[inline]
pub fn root_as_monster_with_opts<'b, 'o>( pub fn root_as_monster_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<Monster<'b>>(opts, buf) ::flatbuffers::root_with_opts::<Monster<'b>>(opts, buf)
} }
#[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Monster` and returns /// bytes contains a size prefixed `Monster` and returns
/// it. Note that verification is still experimental and may not /// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_monster_unchecked`. /// `root_as_monster_unchecked`.
#[inline]
pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>( pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<Monster<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<Monster<'b>>(opts, buf)
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Monster and returns it. /// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Monster`. /// Callers must trust the given bytes do indeed contain a valid `Monster`.
#[inline]
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> { pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { ::flatbuffers::root_unchecked::<Monster>(buf) } unsafe { ::flatbuffers::root_unchecked::<Monster>(buf) }
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
#[inline]
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> { pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) }
} }
pub const MONSTER_IDENTIFIER: &str = "MONS"; pub const MONSTER_IDENTIFIER: &str = "MONS";
#[inline] #[inline]

View File

@@ -4,10 +4,13 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_RACE: i8 = -1; pub const ENUM_MIN_RACE: i8 = -1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_RACE: i8 = 2; pub const ENUM_MAX_RACE: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_RACE: [Race; 4] = [ pub const ENUM_VALUES_RACE: [Race; 4] = [
@@ -20,6 +23,7 @@ pub const ENUM_VALUES_RACE: [Race; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct Race(pub i8); pub struct Race(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Race { impl Race {
pub const None: Self = Self(-1); pub const None: Self = Self(-1);
@@ -35,6 +39,7 @@ impl Race {
Self::Dwarf, Self::Dwarf,
Self::Elf, Self::Elf,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -46,6 +51,7 @@ impl Race {
} }
} }
} }
impl ::core::fmt::Debug for Race { impl ::core::fmt::Debug for Race {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -55,6 +61,7 @@ impl ::core::fmt::Debug for Race {
} }
} }
} }
impl Serialize for Race { impl Serialize for Race {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -85,6 +92,7 @@ impl<'de> serde::Deserialize<'de> for Race {
impl<'a> ::flatbuffers::Follow<'a> for Race { impl<'a> ::flatbuffers::Follow<'a> for Race {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -94,6 +102,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Race {
impl ::flatbuffers::Push for Race { impl ::flatbuffers::Push for Race {
type Output = Race; type Output = Race;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -102,10 +111,12 @@ impl ::flatbuffers::Push for Race {
impl ::flatbuffers::EndianScalar for Race { impl ::flatbuffers::EndianScalar for Race {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum ReferrableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Referrable<'a> { pub struct Referrable<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Referrable<'a> { impl<'a> ::flatbuffers::Follow<'a> for Referrable<'a> {
type Inner = Referrable<'a>; type Inner = Referrable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -30,6 +32,7 @@ impl<'a> Referrable<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Referrable { _tab: table } Referrable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -54,6 +57,7 @@ impl<'a> Referrable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(Referrable::VT_ID, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Referrable) -> bool { pub fn key_compare_less_than(&self, o: &Referrable) -> bool {
self.id() < o.id() self.id() < o.id()
@@ -77,9 +81,11 @@ impl ::flatbuffers::Verifiable for Referrable<'_> {
Ok(()) Ok(())
} }
} }
pub struct ReferrableArgs { pub struct ReferrableArgs {
pub id: u64, pub id: u64,
} }
impl<'a> Default for ReferrableArgs { impl<'a> Default for ReferrableArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -104,11 +110,13 @@ pub struct ReferrableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: u64) { pub fn add_id(&mut self, id: u64) {
self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0); self.fbb_.push_slot::<u64>(Referrable::VT_ID, id, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -117,6 +125,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReferrableBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Referrable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -131,11 +140,13 @@ impl ::core::fmt::Debug for Referrable<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct ReferrableT { pub struct ReferrableT {
pub id: u64, pub id: u64,
} }
impl Default for ReferrableT { impl Default for ReferrableT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -143,6 +154,7 @@ impl Default for ReferrableT {
} }
} }
} }
impl ReferrableT { impl ReferrableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum StatOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Stat<'a> { pub struct Stat<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Stat<'a> { impl<'a> ::flatbuffers::Follow<'a> for Stat<'a> {
type Inner = Stat<'a>; type Inner = Stat<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -32,6 +34,7 @@ impl<'a> Stat<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Stat { _tab: table } Stat { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -64,6 +67,7 @@ impl<'a> Stat<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(Stat::VT_ID, None)}
} }
#[inline] #[inline]
pub fn val(&self) -> i64 { pub fn val(&self) -> i64 {
// Safety: // Safety:
@@ -71,6 +75,7 @@ impl<'a> Stat<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(Stat::VT_VAL, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn count(&self) -> u16 { pub fn count(&self) -> u16 {
// Safety: // Safety:
@@ -78,6 +83,7 @@ impl<'a> Stat<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()} unsafe { self._tab.get::<u16>(Stat::VT_COUNT, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn key_compare_less_than(&self, o: &Stat) -> bool { pub fn key_compare_less_than(&self, o: &Stat) -> bool {
self.count() < o.count() self.count() < o.count()
@@ -103,11 +109,13 @@ impl ::flatbuffers::Verifiable for Stat<'_> {
Ok(()) Ok(())
} }
} }
pub struct StatArgs<'a> { pub struct StatArgs<'a> {
pub id: Option<::flatbuffers::WIPOffset<&'a str>>, pub id: Option<::flatbuffers::WIPOffset<&'a str>>,
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
impl<'a> Default for StatArgs<'a> { impl<'a> Default for StatArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -140,19 +148,23 @@ pub struct StatBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_id(&mut self, id: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_id(&mut self, id: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Stat::VT_ID, id); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Stat::VT_ID, id);
} }
#[inline] #[inline]
pub fn add_val(&mut self, val: i64) { pub fn add_val(&mut self, val: i64) {
self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0); self.fbb_.push_slot::<i64>(Stat::VT_VAL, val, 0);
} }
#[inline] #[inline]
pub fn add_count(&mut self, count: u16) { pub fn add_count(&mut self, count: u16) {
self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0); self.fbb_.push_slot::<u16>(Stat::VT_COUNT, count, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> StatBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -161,6 +173,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> StatBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Stat<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -177,6 +190,7 @@ impl ::core::fmt::Debug for Stat<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct StatT { pub struct StatT {
@@ -184,6 +198,7 @@ pub struct StatT {
pub val: i64, pub val: i64,
pub count: u16, pub count: u16,
} }
impl Default for StatT { impl Default for StatT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -193,6 +208,7 @@ impl Default for StatT {
} }
} }
} }
impl StatT { impl StatT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
// struct StructOfStructs, aligned to 4 // struct StructOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct StructOfStructs(pub [u8; 20]); pub struct StructOfStructs(pub [u8; 20]);
impl Default for StructOfStructs { impl Default for StructOfStructs {
fn default() -> Self { fn default() -> Self {
Self([0; 20]) Self([0; 20])
} }
} }
impl ::core::fmt::Debug for StructOfStructs { impl ::core::fmt::Debug for StructOfStructs {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructs") f.debug_struct("StructOfStructs")
@@ -24,27 +27,34 @@ impl ::core::fmt::Debug for StructOfStructs {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructs {}
impl<'a> ::flatbuffers::Follow<'a> for StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructs {
type Inner = &'a StructOfStructs; type Inner = &'a StructOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructs>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for StructOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructs {
type Output = StructOfStructs; type Output = StructOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -142,6 +152,7 @@ pub struct StructOfStructsT {
pub b: TestT, pub b: TestT,
pub c: AbilityT, pub c: AbilityT,
} }
impl StructOfStructsT { impl StructOfStructsT {
pub fn pack(&self) -> StructOfStructs { pub fn pack(&self) -> StructOfStructs {
StructOfStructs::new( StructOfStructs::new(
@@ -151,4 +162,3 @@ impl StructOfStructsT {
) )
} }
} }

View File

@@ -4,15 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
// struct StructOfStructsOfStructs, aligned to 4 // struct StructOfStructsOfStructs, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct StructOfStructsOfStructs(pub [u8; 20]); pub struct StructOfStructsOfStructs(pub [u8; 20]);
impl Default for StructOfStructsOfStructs { impl Default for StructOfStructsOfStructs {
fn default() -> Self { fn default() -> Self {
Self([0; 20]) Self([0; 20])
} }
} }
impl ::core::fmt::Debug for StructOfStructsOfStructs { impl ::core::fmt::Debug for StructOfStructsOfStructs {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructOfStructsOfStructs") f.debug_struct("StructOfStructsOfStructs")
@@ -22,27 +25,34 @@ impl ::core::fmt::Debug for StructOfStructsOfStructs {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {} impl ::flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
impl<'a> ::flatbuffers::Follow<'a> for StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) } unsafe { <&'a StructOfStructsOfStructs>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs { impl<'a> ::flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
type Inner = &'a StructOfStructsOfStructs; type Inner = &'a StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for StructOfStructsOfStructs { impl<'b> ::flatbuffers::Push for StructOfStructsOfStructs {
type Output = StructOfStructsOfStructs; type Output = StructOfStructsOfStructs;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -106,6 +116,7 @@ impl<'a> StructOfStructsOfStructs {
pub struct StructOfStructsOfStructsT { pub struct StructOfStructsOfStructsT {
pub a: StructOfStructsT, pub a: StructOfStructsT,
} }
impl StructOfStructsOfStructsT { impl StructOfStructsOfStructsT {
pub fn pack(&self) -> StructOfStructsOfStructs { pub fn pack(&self) -> StructOfStructsOfStructs {
StructOfStructsOfStructs::new( StructOfStructsOfStructs::new(
@@ -113,4 +124,3 @@ impl StructOfStructsOfStructsT {
) )
} }
} }

View File

@@ -4,15 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
// struct Test, aligned to 2 // struct Test, aligned to 2
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Test(pub [u8; 4]); pub struct Test(pub [u8; 4]);
impl Default for Test { impl Default for Test {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Test { impl ::core::fmt::Debug for Test {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Test") f.debug_struct("Test")
@@ -23,27 +26,34 @@ impl ::core::fmt::Debug for Test {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Test {} impl ::flatbuffers::SimpleToVerifyInSlice for Test {}
impl<'a> ::flatbuffers::Follow<'a> for Test { impl<'a> ::flatbuffers::Follow<'a> for Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Test>::follow(buf, loc) } unsafe { <&'a Test>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Test { impl<'a> ::flatbuffers::Follow<'a> for &'a Test {
type Inner = &'a Test; type Inner = &'a Test;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Test { impl<'b> ::flatbuffers::Push for Test {
type Output = Test; type Output = Test;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Test as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Test as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(2) ::flatbuffers::PushAlignment::new(2)
@@ -158,6 +168,7 @@ pub struct TestT {
pub a: i16, pub a: i16,
pub b: i8, pub b: i8,
} }
impl TestT { impl TestT {
pub fn pack(&self) -> Test { pub fn pack(&self) -> Test {
Test::new( Test::new(
@@ -166,4 +177,3 @@ impl TestT {
) )
} }
} }

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TestSimpleTableWithEnumOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TestSimpleTableWithEnum<'a> { pub struct TestSimpleTableWithEnum<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> { impl<'a> ::flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
type Inner = TestSimpleTableWithEnum<'a>; type Inner = TestSimpleTableWithEnum<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -30,6 +32,7 @@ impl<'a> TestSimpleTableWithEnum<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TestSimpleTableWithEnum { _tab: table } TestSimpleTableWithEnum { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for TestSimpleTableWithEnum<'_> {
Ok(()) Ok(())
} }
} }
pub struct TestSimpleTableWithEnumArgs { pub struct TestSimpleTableWithEnumArgs {
pub color: Color, pub color: Color,
} }
impl<'a> Default for TestSimpleTableWithEnumArgs { impl<'a> Default for TestSimpleTableWithEnumArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -94,11 +99,13 @@ pub struct TestSimpleTableWithEnumBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocato
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_color(&mut self, color: Color) { pub fn add_color(&mut self, color: Color) {
self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green); self.fbb_.push_slot::<Color>(TestSimpleTableWithEnum::VT_COLOR, color, Color::Green);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TestSimpleTableWithEnumBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -107,6 +114,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TestSimpleTableWithEnumBuilde
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TestSimpleTableWithEnum<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -121,11 +129,13 @@ impl ::core::fmt::Debug for TestSimpleTableWithEnum<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TestSimpleTableWithEnumT { pub struct TestSimpleTableWithEnumT {
pub color: Color, pub color: Color,
} }
impl Default for TestSimpleTableWithEnumT { impl Default for TestSimpleTableWithEnumT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -133,6 +143,7 @@ impl Default for TestSimpleTableWithEnumT {
} }
} }
} }
impl TestSimpleTableWithEnumT { impl TestSimpleTableWithEnumT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TypeAliasesOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TypeAliases<'a> { pub struct TypeAliases<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TypeAliases<'a> { impl<'a> ::flatbuffers::Follow<'a> for TypeAliases<'a> {
type Inner = TypeAliases<'a>; type Inner = TypeAliases<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -41,6 +43,7 @@ impl<'a> TypeAliases<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TypeAliases { _tab: table } TypeAliases { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -102,6 +105,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()} unsafe { self._tab.get::<i8>(TypeAliases::VT_I8_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u8_(&self) -> u8 { pub fn u8_(&self) -> u8 {
// Safety: // Safety:
@@ -109,6 +113,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()} unsafe { self._tab.get::<u8>(TypeAliases::VT_U8_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn i16_(&self) -> i16 { pub fn i16_(&self) -> i16 {
// Safety: // Safety:
@@ -116,6 +121,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()} unsafe { self._tab.get::<i16>(TypeAliases::VT_I16_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u16_(&self) -> u16 { pub fn u16_(&self) -> u16 {
// Safety: // Safety:
@@ -123,6 +129,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()} unsafe { self._tab.get::<u16>(TypeAliases::VT_U16_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn i32_(&self) -> i32 { pub fn i32_(&self) -> i32 {
// Safety: // Safety:
@@ -130,6 +137,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()} unsafe { self._tab.get::<i32>(TypeAliases::VT_I32_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u32_(&self) -> u32 { pub fn u32_(&self) -> u32 {
// Safety: // Safety:
@@ -137,6 +145,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()} unsafe { self._tab.get::<u32>(TypeAliases::VT_U32_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn i64_(&self) -> i64 { pub fn i64_(&self) -> i64 {
// Safety: // Safety:
@@ -144,6 +153,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(TypeAliases::VT_I64_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn u64_(&self) -> u64 { pub fn u64_(&self) -> u64 {
// Safety: // Safety:
@@ -151,6 +161,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(TypeAliases::VT_U64_, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn f32_(&self) -> f32 { pub fn f32_(&self) -> f32 {
// Safety: // Safety:
@@ -158,6 +169,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()} unsafe { self._tab.get::<f32>(TypeAliases::VT_F32_, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn f64_(&self) -> f64 { pub fn f64_(&self) -> f64 {
// Safety: // Safety:
@@ -165,6 +177,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()} unsafe { self._tab.get::<f64>(TypeAliases::VT_F64_, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn v8(&self) -> Option<::flatbuffers::Vector<'a, i8>> { pub fn v8(&self) -> Option<::flatbuffers::Vector<'a, i8>> {
// Safety: // Safety:
@@ -172,6 +185,7 @@ impl<'a> TypeAliases<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i8>>>(TypeAliases::VT_V8, None)}
} }
#[inline] #[inline]
pub fn vf64(&self) -> Option<::flatbuffers::Vector<'a, f64>> { pub fn vf64(&self) -> Option<::flatbuffers::Vector<'a, f64>> {
// Safety: // Safety:
@@ -203,6 +217,7 @@ impl ::flatbuffers::Verifiable for TypeAliases<'_> {
Ok(()) Ok(())
} }
} }
pub struct TypeAliasesArgs<'a> { pub struct TypeAliasesArgs<'a> {
pub i8_: i8, pub i8_: i8,
pub u8_: u8, pub u8_: u8,
@@ -217,6 +232,7 @@ pub struct TypeAliasesArgs<'a> {
pub v8: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i8>>>, pub v8: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i8>>>,
pub vf64: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f64>>>, pub vf64: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f64>>>,
} }
impl<'a> Default for TypeAliasesArgs<'a> { impl<'a> Default for TypeAliasesArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -271,55 +287,68 @@ pub struct TypeAliasesBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_i8_(&mut self, i8_: i8) { pub fn add_i8_(&mut self, i8_: i8) {
self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0); self.fbb_.push_slot::<i8>(TypeAliases::VT_I8_, i8_, 0);
} }
#[inline] #[inline]
pub fn add_u8_(&mut self, u8_: u8) { pub fn add_u8_(&mut self, u8_: u8) {
self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0); self.fbb_.push_slot::<u8>(TypeAliases::VT_U8_, u8_, 0);
} }
#[inline] #[inline]
pub fn add_i16_(&mut self, i16_: i16) { pub fn add_i16_(&mut self, i16_: i16) {
self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0); self.fbb_.push_slot::<i16>(TypeAliases::VT_I16_, i16_, 0);
} }
#[inline] #[inline]
pub fn add_u16_(&mut self, u16_: u16) { pub fn add_u16_(&mut self, u16_: u16) {
self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0); self.fbb_.push_slot::<u16>(TypeAliases::VT_U16_, u16_, 0);
} }
#[inline] #[inline]
pub fn add_i32_(&mut self, i32_: i32) { pub fn add_i32_(&mut self, i32_: i32) {
self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0); self.fbb_.push_slot::<i32>(TypeAliases::VT_I32_, i32_, 0);
} }
#[inline] #[inline]
pub fn add_u32_(&mut self, u32_: u32) { pub fn add_u32_(&mut self, u32_: u32) {
self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0); self.fbb_.push_slot::<u32>(TypeAliases::VT_U32_, u32_, 0);
} }
#[inline] #[inline]
pub fn add_i64_(&mut self, i64_: i64) { pub fn add_i64_(&mut self, i64_: i64) {
self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0); self.fbb_.push_slot::<i64>(TypeAliases::VT_I64_, i64_, 0);
} }
#[inline] #[inline]
pub fn add_u64_(&mut self, u64_: u64) { pub fn add_u64_(&mut self, u64_: u64) {
self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0); self.fbb_.push_slot::<u64>(TypeAliases::VT_U64_, u64_, 0);
} }
#[inline] #[inline]
pub fn add_f32_(&mut self, f32_: f32) { pub fn add_f32_(&mut self, f32_: f32) {
self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0); self.fbb_.push_slot::<f32>(TypeAliases::VT_F32_, f32_, 0.0);
} }
#[inline] #[inline]
pub fn add_f64_(&mut self, f64_: f64) { pub fn add_f64_(&mut self, f64_: f64) {
self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0); self.fbb_.push_slot::<f64>(TypeAliases::VT_F64_, f64_, 0.0);
} }
#[inline] #[inline]
pub fn add_v8(&mut self, v8: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i8>>) { pub fn add_v8(&mut self, v8: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i8>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_V8, v8);
} }
#[inline] #[inline]
pub fn add_vf64(&mut self, vf64: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) { pub fn add_vf64(&mut self, vf64: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TypeAliases::VT_VF64, vf64);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TypeAliasesBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -328,6 +357,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TypeAliasesBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TypeAliases<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -353,6 +383,7 @@ impl ::core::fmt::Debug for TypeAliases<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TypeAliasesT { pub struct TypeAliasesT {
@@ -369,6 +400,7 @@ pub struct TypeAliasesT {
pub v8: Option<alloc::vec::Vec<i8>>, pub v8: Option<alloc::vec::Vec<i8>>,
pub vf64: Option<alloc::vec::Vec<f64>>, pub vf64: Option<alloc::vec::Vec<f64>>,
} }
impl Default for TypeAliasesT { impl Default for TypeAliasesT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -387,6 +419,7 @@ impl Default for TypeAliasesT {
} }
} }
} }
impl TypeAliasesT { impl TypeAliasesT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
// struct Vec3, aligned to 8 // struct Vec3, aligned to 8
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Vec3(pub [u8; 32]); pub struct Vec3(pub [u8; 32]);
impl Default for Vec3 { impl Default for Vec3 {
fn default() -> Self { fn default() -> Self {
Self([0; 32]) Self([0; 32])
} }
} }
impl ::core::fmt::Debug for Vec3 { impl ::core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Vec3") f.debug_struct("Vec3")
@@ -27,27 +30,34 @@ impl ::core::fmt::Debug for Vec3 {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {} impl ::flatbuffers::SimpleToVerifyInSlice for Vec3 {}
impl<'a> ::flatbuffers::Follow<'a> for Vec3 { impl<'a> ::flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Vec3>::follow(buf, loc) } unsafe { <&'a Vec3>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 { impl<'a> ::flatbuffers::Follow<'a> for &'a Vec3 {
type Inner = &'a Vec3; type Inner = &'a Vec3;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Vec3>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Vec3 { impl<'b> ::flatbuffers::Push for Vec3 {
type Output = Vec3; type Output = Vec3;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8) ::flatbuffers::PushAlignment::new(8)
@@ -281,6 +291,7 @@ pub struct Vec3T {
pub test2: Color, pub test2: Color,
pub test3: TestT, pub test3: TestT,
} }
impl Vec3T { impl Vec3T {
pub fn pack(&self) -> Vec3 { pub fn pack(&self) -> Vec3 {
Vec3::new( Vec3::new(
@@ -293,4 +304,3 @@ impl Vec3T {
) )
} }
} }

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum MonsterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> { pub struct Monster<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> { impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'a>; type Inner = Monster<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -20,7 +22,6 @@ impl<'a> ::flatbuffers::Follow<'a> for Monster<'a> {
} }
impl<'a> Monster<'a> { impl<'a> Monster<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.Example2.Monster" "MyGame.Example2.Monster"
} }
@@ -29,6 +30,7 @@ impl<'a> Monster<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Monster { _tab: table } Monster { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -54,8 +56,10 @@ impl ::flatbuffers::Verifiable for Monster<'_> {
Ok(()) Ok(())
} }
} }
pub struct MonsterArgs { pub struct MonsterArgs {
} }
impl<'a> Default for MonsterArgs { impl<'a> Default for MonsterArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -78,6 +82,7 @@ pub struct MonsterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MonsterBuilder<'a, 'b, A> {
@@ -87,6 +92,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MonsterBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Monster<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -100,16 +106,19 @@ impl ::core::fmt::Debug for Monster<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct MonsterT { pub struct MonsterT {
} }
impl Default for MonsterT { impl Default for MonsterT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl MonsterT { impl MonsterT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum InParentNamespaceOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct InParentNamespace<'a> { pub struct InParentNamespace<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> { impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
type Inner = InParentNamespace<'a>; type Inner = InParentNamespace<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -20,7 +22,6 @@ impl<'a> ::flatbuffers::Follow<'a> for InParentNamespace<'a> {
} }
impl<'a> InParentNamespace<'a> { impl<'a> InParentNamespace<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"MyGame.InParentNamespace" "MyGame.InParentNamespace"
} }
@@ -29,6 +30,7 @@ impl<'a> InParentNamespace<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
InParentNamespace { _tab: table } InParentNamespace { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -54,8 +56,10 @@ impl ::flatbuffers::Verifiable for InParentNamespace<'_> {
Ok(()) Ok(())
} }
} }
pub struct InParentNamespaceArgs { pub struct InParentNamespaceArgs {
} }
impl<'a> Default for InParentNamespaceArgs { impl<'a> Default for InParentNamespaceArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -78,6 +82,7 @@ pub struct InParentNamespaceBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> InParentNamespaceBuilder<'a, 'b, A> {
@@ -87,6 +92,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> InParentNamespaceBuilder<'a,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<InParentNamespace<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -100,16 +106,19 @@ impl ::core::fmt::Debug for InParentNamespace<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct InParentNamespaceT { pub struct InParentNamespaceT {
} }
impl Default for InParentNamespaceT { impl Default for InParentNamespaceT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl InParentNamespaceT { impl InParentNamespaceT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,10 +4,13 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FROM_INCLUDE: i64 = 0; pub const ENUM_MIN_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FROM_INCLUDE: i64 = 0; pub const ENUM_MAX_FROM_INCLUDE: i64 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct FromInclude(pub i64); pub struct FromInclude(pub i64);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl FromInclude { impl FromInclude {
pub const IncludeVal: Self = Self(0); pub const IncludeVal: Self = Self(0);
@@ -26,6 +30,7 @@ impl FromInclude {
pub const ENUM_VALUES: &'static [Self] = &[ pub const ENUM_VALUES: &'static [Self] = &[
Self::IncludeVal, Self::IncludeVal,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -34,6 +39,7 @@ impl FromInclude {
} }
} }
} }
impl ::core::fmt::Debug for FromInclude { impl ::core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -43,6 +49,7 @@ impl ::core::fmt::Debug for FromInclude {
} }
} }
} }
impl Serialize for FromInclude { impl Serialize for FromInclude {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -73,6 +80,7 @@ impl<'de> serde::Deserialize<'de> for FromInclude {
impl<'a> ::flatbuffers::Follow<'a> for FromInclude { impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i64>(buf, loc) };
@@ -82,6 +90,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FromInclude {
impl ::flatbuffers::Push for FromInclude { impl ::flatbuffers::Push for FromInclude {
type Output = FromInclude; type Output = FromInclude;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i64>(dst, self.0) };
@@ -90,10 +99,12 @@ impl ::flatbuffers::Push for FromInclude {
impl ::flatbuffers::EndianScalar for FromInclude { impl ::flatbuffers::EndianScalar for FromInclude {
type Scalar = i64; type Scalar = i64;
#[inline] #[inline]
fn to_little_endian(self) -> i64 { fn to_little_endian(self) -> i64 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i64) -> Self { fn from_little_endian(v: i64) -> Self {

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableBOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableB<'a> { pub struct TableB<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>; type Inner = TableB<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -30,6 +32,7 @@ impl<'a> TableB<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableB { _tab: table } TableB { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -69,9 +72,11 @@ impl ::flatbuffers::Verifiable for TableB<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableBArgs<'a> { pub struct TableBArgs<'a> {
pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>, pub a: Option<::flatbuffers::WIPOffset<super::super::TableA<'a>>>,
} }
impl<'a> Default for TableBArgs<'a> { impl<'a> Default for TableBArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -100,11 +105,13 @@ pub struct TableBBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) { pub fn add_a(&mut self, a: ::flatbuffers::WIPOffset<super::super::TableA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::super::TableA>>(TableB::VT_A, a);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableBBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -113,6 +120,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableBBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableB<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -127,11 +135,13 @@ impl ::core::fmt::Debug for TableB<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableBT { pub struct TableBT {
pub a: Option<alloc::boxed::Box<super::super::TableAT>>, pub a: Option<alloc::boxed::Box<super::super::TableAT>>,
} }
impl Default for TableBT { impl Default for TableBT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -139,6 +149,7 @@ impl Default for TableBT {
} }
} }
} }
impl TableBT { impl TableBT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -4,15 +4,18 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
// struct Unused, aligned to 4 // struct Unused, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct Unused(pub [u8; 4]); pub struct Unused(pub [u8; 4]);
impl Default for Unused { impl Default for Unused {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Unused { impl ::core::fmt::Debug for Unused {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Unused") f.debug_struct("Unused")
@@ -22,27 +25,34 @@ impl ::core::fmt::Debug for Unused {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Unused {} impl ::flatbuffers::SimpleToVerifyInSlice for Unused {}
impl<'a> ::flatbuffers::Follow<'a> for Unused { impl<'a> ::flatbuffers::Follow<'a> for Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Unused>::follow(buf, loc) } unsafe { <&'a Unused>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Unused { impl<'a> ::flatbuffers::Follow<'a> for &'a Unused {
type Inner = &'a Unused; type Inner = &'a Unused;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Unused>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Unused { impl<'b> ::flatbuffers::Push for Unused {
type Output = Unused; type Output = Unused;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Unused as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -123,6 +133,7 @@ impl<'a> Unused {
pub struct UnusedT { pub struct UnusedT {
pub a: i32, pub a: i32,
} }
impl UnusedT { impl UnusedT {
pub fn pack(&self) -> Unused { pub fn pack(&self) -> Unused {
Unused::new( Unused::new(
@@ -130,4 +141,3 @@ impl UnusedT {
) )
} }
} }

View File

@@ -4,15 +4,17 @@ extern crate alloc;
extern crate serde; extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct}; use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use super::*; use super::*;
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableA<'a> { pub struct TableA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>; type Inner = TableA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -30,6 +32,7 @@ impl<'a> TableA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableA { _tab: table } TableA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -69,9 +72,11 @@ impl ::flatbuffers::Verifiable for TableA<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableAArgs<'a> { pub struct TableAArgs<'a> {
pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>, pub b: Option<::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
} }
impl<'a> Default for TableAArgs<'a> { impl<'a> Default for TableAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -100,11 +105,13 @@ pub struct TableABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) { pub fn add_b(&mut self, b: ::flatbuffers::WIPOffset<my_game::other_name_space::TableB<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<my_game::other_name_space::TableB>>(TableA::VT_B, b);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -113,6 +120,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableABuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -127,11 +135,13 @@ impl ::core::fmt::Debug for TableA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableAT { pub struct TableAT {
pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>, pub b: Option<alloc::boxed::Box<my_game::other_name_space::TableBT>>,
} }
impl Default for TableAT { impl Default for TableAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -139,6 +149,7 @@ impl Default for TableAT {
} }
} }
} }
impl TableAT { impl TableAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ABC: i32 = 0; pub const ENUM_MIN_ABC: i32 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ABC: i32 = 2; pub const ENUM_MAX_ABC: i32 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ABC: [ABC; 3] = [ pub const ENUM_VALUES_ABC: [ABC; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_ABC: [ABC; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct ABC(pub i32); pub struct ABC(pub i32);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl ABC { impl ABC {
pub const A: Self = Self(0); pub const A: Self = Self(0);
@@ -30,6 +34,7 @@ impl ABC {
Self::B, Self::B,
Self::C, Self::C,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl ABC {
} }
} }
} }
impl ::core::fmt::Debug for ABC { impl ::core::fmt::Debug for ABC {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for ABC {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for ABC { impl<'a> ::flatbuffers::Follow<'a> for ABC {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for ABC {
impl ::flatbuffers::Push for ABC { impl ::flatbuffers::Push for ABC {
type Output = ABC; type Output = ABC;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for ABC {
impl ::flatbuffers::EndianScalar for ABC { impl ::flatbuffers::EndianScalar for ABC {
type Scalar = i32; type Scalar = i32;
#[inline] #[inline]
fn to_little_endian(self) -> i32 { fn to_little_endian(self) -> i32 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i32) -> Self { fn from_little_endian(v: i32) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum MoreDefaultsOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum MoreDefaultsOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct MoreDefaults<'a> { pub struct MoreDefaults<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for MoreDefaults<'a> { impl<'a> ::flatbuffers::Follow<'a> for MoreDefaults<'a> {
type Inner = MoreDefaults<'a>; type Inner = MoreDefaults<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -33,6 +35,7 @@ impl<'a> MoreDefaults<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
MoreDefaults { _tab: table } MoreDefaults { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -90,6 +93,7 @@ impl<'a> MoreDefaults<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i32>>>(MoreDefaults::VT_INTS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, i32>>>(MoreDefaults::VT_INTS, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn floats(&self) -> ::flatbuffers::Vector<'a, f32> { pub fn floats(&self) -> ::flatbuffers::Vector<'a, f32> {
// Safety: // Safety:
@@ -97,6 +101,7 @@ impl<'a> MoreDefaults<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(MoreDefaults::VT_FLOATS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(MoreDefaults::VT_FLOATS, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn empty_string(&self) -> &'a str { pub fn empty_string(&self) -> &'a str {
// Safety: // Safety:
@@ -104,6 +109,7 @@ impl<'a> MoreDefaults<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_EMPTY_STRING, Some(&"")).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_EMPTY_STRING, Some(&"")).unwrap()}
} }
#[inline] #[inline]
pub fn some_string(&self) -> &'a str { pub fn some_string(&self) -> &'a str {
// Safety: // Safety:
@@ -111,6 +117,7 @@ impl<'a> MoreDefaults<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_SOME_STRING, Some(&"some")).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(MoreDefaults::VT_SOME_STRING, Some(&"some")).unwrap()}
} }
#[inline] #[inline]
pub fn abcs(&self) -> ::flatbuffers::Vector<'a, ABC> { pub fn abcs(&self) -> ::flatbuffers::Vector<'a, ABC> {
// Safety: // Safety:
@@ -118,6 +125,7 @@ impl<'a> MoreDefaults<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ABC>>>(MoreDefaults::VT_ABCS, Some(Default::default())).unwrap()} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ABC>>>(MoreDefaults::VT_ABCS, Some(Default::default())).unwrap()}
} }
#[inline] #[inline]
pub fn bools(&self) -> ::flatbuffers::Vector<'a, bool> { pub fn bools(&self) -> ::flatbuffers::Vector<'a, bool> {
// Safety: // Safety:
@@ -143,6 +151,7 @@ impl ::flatbuffers::Verifiable for MoreDefaults<'_> {
Ok(()) Ok(())
} }
} }
pub struct MoreDefaultsArgs<'a> { pub struct MoreDefaultsArgs<'a> {
pub ints: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i32>>>, pub ints: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, i32>>>,
pub floats: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>, pub floats: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
@@ -151,6 +160,7 @@ pub struct MoreDefaultsArgs<'a> {
pub abcs: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ABC>>>, pub abcs: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ABC>>>,
pub bools: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, bool>>>, pub bools: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, bool>>>,
} }
impl<'a> Default for MoreDefaultsArgs<'a> { impl<'a> Default for MoreDefaultsArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -169,31 +179,38 @@ pub struct MoreDefaultsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MoreDefaultsBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MoreDefaultsBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_ints(&mut self, ints: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i32>>) { pub fn add_ints(&mut self, ints: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , i32>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_INTS, ints); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_INTS, ints);
} }
#[inline] #[inline]
pub fn add_floats(&mut self, floats: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) { pub fn add_floats(&mut self, floats: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_FLOATS, floats); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_FLOATS, floats);
} }
#[inline] #[inline]
pub fn add_empty_string(&mut self, empty_string: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_empty_string(&mut self, empty_string: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_EMPTY_STRING, empty_string); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_EMPTY_STRING, empty_string);
} }
#[inline] #[inline]
pub fn add_some_string(&mut self, some_string: ::flatbuffers::WIPOffset<&'b str>) { pub fn add_some_string(&mut self, some_string: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_SOME_STRING, some_string); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_SOME_STRING, some_string);
} }
#[inline] #[inline]
pub fn add_abcs(&mut self, abcs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ABC>>) { pub fn add_abcs(&mut self, abcs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ABC>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_ABCS, abcs); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_ABCS, abcs);
} }
#[inline] #[inline]
pub fn add_bools(&mut self, bools: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , bool>>) { pub fn add_bools(&mut self, bools: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , bool>>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_BOOLS, bools); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(MoreDefaults::VT_BOOLS, bools);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MoreDefaultsBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> MoreDefaultsBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -202,6 +219,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> MoreDefaultsBuilder<'a, 'b, A
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<MoreDefaults<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<MoreDefaults<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -221,6 +239,7 @@ impl ::core::fmt::Debug for MoreDefaults<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct MoreDefaultsT { pub struct MoreDefaultsT {
@@ -231,6 +250,7 @@ pub struct MoreDefaultsT {
pub abcs: alloc::vec::Vec<ABC>, pub abcs: alloc::vec::Vec<ABC>,
pub bools: alloc::vec::Vec<bool>, pub bools: alloc::vec::Vec<bool>,
} }
impl Default for MoreDefaultsT { impl Default for MoreDefaultsT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -243,6 +263,7 @@ impl Default for MoreDefaultsT {
} }
} }
} }
impl MoreDefaultsT { impl MoreDefaultsT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0; pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ENUM_IN_NESTED_NS: i8 = 2; pub const ENUM_MAX_ENUM_IN_NESTED_NS: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [ pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct EnumInNestedNS(pub i8); pub struct EnumInNestedNS(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl EnumInNestedNS { impl EnumInNestedNS {
pub const A: Self = Self(0); pub const A: Self = Self(0);
@@ -30,6 +34,7 @@ impl EnumInNestedNS {
Self::B, Self::B,
Self::C, Self::C,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl EnumInNestedNS {
} }
} }
} }
impl ::core::fmt::Debug for EnumInNestedNS { impl ::core::fmt::Debug for EnumInNestedNS {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for EnumInNestedNS {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for EnumInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for EnumInNestedNS {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for EnumInNestedNS {
impl ::flatbuffers::Push for EnumInNestedNS { impl ::flatbuffers::Push for EnumInNestedNS {
type Output = EnumInNestedNS; type Output = EnumInNestedNS;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for EnumInNestedNS {
impl ::flatbuffers::EndianScalar for EnumInNestedNS { impl ::flatbuffers::EndianScalar for EnumInNestedNS {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct StructInNestedNS, aligned to 4 // struct StructInNestedNS, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct StructInNestedNS(pub [u8; 8]); pub struct StructInNestedNS(pub [u8; 8]);
impl Default for StructInNestedNS { impl Default for StructInNestedNS {
fn default() -> Self { fn default() -> Self {
Self([0; 8]) Self([0; 8])
} }
} }
impl ::core::fmt::Debug for StructInNestedNS { impl ::core::fmt::Debug for StructInNestedNS {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("StructInNestedNS") f.debug_struct("StructInNestedNS")
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for StructInNestedNS {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {} impl ::flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {}
impl<'a> ::flatbuffers::Follow<'a> for StructInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for StructInNestedNS {
type Inner = &'a StructInNestedNS; type Inner = &'a StructInNestedNS;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a StructInNestedNS>::follow(buf, loc) } unsafe { <&'a StructInNestedNS>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a StructInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for &'a StructInNestedNS {
type Inner = &'a StructInNestedNS; type Inner = &'a StructInNestedNS;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for StructInNestedNS { impl<'b> ::flatbuffers::Push for StructInNestedNS {
type Output = StructInNestedNS; type Output = StructInNestedNS;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -144,6 +154,7 @@ pub struct StructInNestedNST {
pub a: i32, pub a: i32,
pub b: i32, pub b: i32,
} }
impl StructInNestedNST { impl StructInNestedNST {
pub fn pack(&self) -> StructInNestedNS { pub fn pack(&self) -> StructInNestedNS {
StructInNestedNS::new( StructInNestedNS::new(
@@ -152,4 +163,3 @@ impl StructInNestedNST {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableInNestedNSOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableInNestedNSOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableInNestedNS<'a> { pub struct TableInNestedNS<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableInNestedNS<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableInNestedNS<'a> {
type Inner = TableInNestedNS<'a>; type Inner = TableInNestedNS<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> TableInNestedNS<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableInNestedNS { _tab: table } TableInNestedNS { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -65,9 +68,11 @@ impl ::flatbuffers::Verifiable for TableInNestedNS<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableInNestedNSArgs { pub struct TableInNestedNSArgs {
pub foo: i32, pub foo: i32,
} }
impl<'a> Default for TableInNestedNSArgs { impl<'a> Default for TableInNestedNSArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -81,11 +86,13 @@ pub struct TableInNestedNSBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a>
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_foo(&mut self, foo: i32) { pub fn add_foo(&mut self, foo: i32) {
self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0); self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInNestedNSBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInNestedNSBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -94,6 +101,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInNestedNS<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInNestedNS<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -108,11 +116,13 @@ impl ::core::fmt::Debug for TableInNestedNS<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableInNestedNST { pub struct TableInNestedNST {
pub foo: i32, pub foo: i32,
} }
impl Default for TableInNestedNST { impl Default for TableInNestedNST {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -120,6 +130,7 @@ impl Default for TableInNestedNST {
} }
} }
} }
impl TableInNestedNST { impl TableInNestedNST {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0; pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_UNION_IN_NESTED_NS: u8 = 1; pub const ENUM_MAX_UNION_IN_NESTED_NS: u8 = 1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_UNION_IN_NESTED_NS: [UnionInNestedNS; 2] = [ pub const ENUM_VALUES_UNION_IN_NESTED_NS: [UnionInNestedNS; 2] = [
@@ -16,6 +19,7 @@ pub const ENUM_VALUES_UNION_IN_NESTED_NS: [UnionInNestedNS; 2] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct UnionInNestedNS(pub u8); pub struct UnionInNestedNS(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl UnionInNestedNS { impl UnionInNestedNS {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -27,6 +31,7 @@ impl UnionInNestedNS {
Self::NONE, Self::NONE,
Self::TableInNestedNS, Self::TableInNestedNS,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -36,6 +41,7 @@ impl UnionInNestedNS {
} }
} }
} }
impl ::core::fmt::Debug for UnionInNestedNS { impl ::core::fmt::Debug for UnionInNestedNS {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -45,8 +51,10 @@ impl ::core::fmt::Debug for UnionInNestedNS {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for UnionInNestedNS { impl<'a> ::flatbuffers::Follow<'a> for UnionInNestedNS {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -56,6 +64,7 @@ impl<'a> ::flatbuffers::Follow<'a> for UnionInNestedNS {
impl ::flatbuffers::Push for UnionInNestedNS { impl ::flatbuffers::Push for UnionInNestedNS {
type Output = UnionInNestedNS; type Output = UnionInNestedNS;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -64,10 +73,12 @@ impl ::flatbuffers::Push for UnionInNestedNS {
impl ::flatbuffers::EndianScalar for UnionInNestedNS { impl ::flatbuffers::EndianScalar for UnionInNestedNS {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -86,6 +97,7 @@ impl<'a> ::flatbuffers::Verifiable for UnionInNestedNS {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {} impl ::flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {}
pub struct UnionInNestedNSUnionTableOffset {} pub struct UnionInNestedNSUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -95,11 +107,13 @@ pub enum UnionInNestedNST {
NONE, NONE,
TableInNestedNS(alloc::boxed::Box<TableInNestedNST>), TableInNestedNS(alloc::boxed::Box<TableInNestedNST>),
} }
impl Default for UnionInNestedNST { impl Default for UnionInNestedNST {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl UnionInNestedNST { impl UnionInNestedNST {
pub fn union_in_nested_ns_type(&self) -> UnionInNestedNS { pub fn union_in_nested_ns_type(&self) -> UnionInNestedNS {
match self { match self {
@@ -107,12 +121,14 @@ impl UnionInNestedNST {
Self::TableInNestedNS(_) => UnionInNestedNS::TableInNestedNS, Self::TableInNestedNS(_) => UnionInNestedNS::TableInNestedNS,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()), Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE. /// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE.
pub fn take_table_in_nested_ns(&mut self) -> Option<alloc::boxed::Box<TableInNestedNST>> { pub fn take_table_in_nested_ns(&mut self) -> Option<alloc::boxed::Box<TableInNestedNST>> {
if let Self::TableInNestedNS(_) = self { if let Self::TableInNestedNS(_) = self {
@@ -126,12 +142,15 @@ impl UnionInNestedNST {
None None
} }
} }
/// If the union variant matches, return a reference to the TableInNestedNST. /// If the union variant matches, return a reference to the TableInNestedNST.
pub fn as_table_in_nested_ns(&self) -> Option<&TableInNestedNST> { pub fn as_table_in_nested_ns(&self) -> Option<&TableInNestedNST> {
if let Self::TableInNestedNS(v) = self { Some(v.as_ref()) } else { None } if let Self::TableInNestedNS(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the TableInNestedNST. /// If the union variant matches, return a mutable reference to the TableInNestedNST.
pub fn as_table_in_nested_ns_mut(&mut self) -> Option<&mut TableInNestedNST> { pub fn as_table_in_nested_ns_mut(&mut self) -> Option<&mut TableInNestedNST> {
if let Self::TableInNestedNS(v) = self { Some(v.as_mut()) } else { None } if let Self::TableInNestedNS(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum SecondTableInAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum SecondTableInAOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct SecondTableInA<'a> { pub struct SecondTableInA<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for SecondTableInA<'a> { impl<'a> ::flatbuffers::Follow<'a> for SecondTableInA<'a> {
type Inner = SecondTableInA<'a>; type Inner = SecondTableInA<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> SecondTableInA<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
SecondTableInA { _tab: table } SecondTableInA { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for SecondTableInA<'_> {
Ok(()) Ok(())
} }
} }
pub struct SecondTableInAArgs<'a> { pub struct SecondTableInAArgs<'a> {
pub refer_to_c: Option<::flatbuffers::WIPOffset<super::namespace_c::TableInC<'a>>>, pub refer_to_c: Option<::flatbuffers::WIPOffset<super::namespace_c::TableInC<'a>>>,
} }
impl<'a> Default for SecondTableInAArgs<'a> { impl<'a> Default for SecondTableInAArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -83,11 +88,13 @@ pub struct SecondTableInABuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_refer_to_c(&mut self, refer_to_c: ::flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) { pub fn add_refer_to_c(&mut self, refer_to_c: ::flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> SecondTableInABuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> SecondTableInABuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<SecondTableInA<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<SecondTableInA<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for SecondTableInA<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct SecondTableInAT { pub struct SecondTableInAT {
pub refer_to_c: Option<alloc::boxed::Box<super::namespace_c::TableInCT>>, pub refer_to_c: Option<alloc::boxed::Box<super::namespace_c::TableInCT>>,
} }
impl Default for SecondTableInAT { impl Default for SecondTableInAT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -122,6 +132,7 @@ impl Default for SecondTableInAT {
} }
} }
} }
impl SecondTableInAT { impl SecondTableInAT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableInFirstNSOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableInFirstNSOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableInFirstNS<'a> { pub struct TableInFirstNS<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableInFirstNS<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableInFirstNS<'a> {
type Inner = TableInFirstNS<'a>; type Inner = TableInFirstNS<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -32,6 +34,7 @@ impl<'a> TableInFirstNS<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableInFirstNS { _tab: table } TableInFirstNS { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -78,6 +81,7 @@ impl<'a> TableInFirstNS<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, None)}
} }
#[inline] #[inline]
pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS { pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS {
// Safety: // Safety:
@@ -85,6 +89,7 @@ impl<'a> TableInFirstNS<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()} unsafe { self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()}
} }
#[inline] #[inline]
pub fn foo_union_type(&self) -> namespace_b::UnionInNestedNS { pub fn foo_union_type(&self) -> namespace_b::UnionInNestedNS {
// Safety: // Safety:
@@ -92,6 +97,7 @@ impl<'a> TableInFirstNS<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, Some(namespace_b::UnionInNestedNS::NONE)).unwrap()} unsafe { self._tab.get::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, Some(namespace_b::UnionInNestedNS::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn foo_union(&self) -> Option<::flatbuffers::Table<'a>> { pub fn foo_union(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -99,6 +105,7 @@ impl<'a> TableInFirstNS<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(TableInFirstNS::VT_FOO_UNION, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(TableInFirstNS::VT_FOO_UNION, None)}
} }
#[inline] #[inline]
pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> { pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> {
// Safety: // Safety:
@@ -106,6 +113,7 @@ impl<'a> TableInFirstNS<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)} unsafe { self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn foo_union_as_table_in_nested_ns(&self) -> Option<namespace_b::TableInNestedNS<'a>> { pub fn foo_union_as_table_in_nested_ns(&self) -> Option<namespace_b::TableInNestedNS<'a>> {
@@ -120,7 +128,6 @@ impl<'a> TableInFirstNS<'a> {
None None
} }
} }
} }
impl ::flatbuffers::Verifiable for TableInFirstNS<'_> { impl ::flatbuffers::Verifiable for TableInFirstNS<'_> {
@@ -142,6 +149,7 @@ impl ::flatbuffers::Verifiable for TableInFirstNS<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableInFirstNSArgs<'a> { pub struct TableInFirstNSArgs<'a> {
pub foo_table: Option<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a>>>, pub foo_table: Option<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a>>>,
pub foo_enum: namespace_b::EnumInNestedNS, pub foo_enum: namespace_b::EnumInNestedNS,
@@ -149,6 +157,7 @@ pub struct TableInFirstNSArgs<'a> {
pub foo_union: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>, pub foo_union: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
pub foo_struct: Option<&'a namespace_b::StructInNestedNS>, pub foo_struct: Option<&'a namespace_b::StructInNestedNS>,
} }
impl<'a> Default for TableInFirstNSArgs<'a> { impl<'a> Default for TableInFirstNSArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -166,27 +175,33 @@ pub struct TableInFirstNSBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_foo_table(&mut self, foo_table: ::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) { pub fn add_foo_table(&mut self, foo_table: ::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table);
} }
#[inline] #[inline]
pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) { pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) {
self.fbb_.push_slot::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, foo_enum, namespace_b::EnumInNestedNS::A); self.fbb_.push_slot::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, foo_enum, namespace_b::EnumInNestedNS::A);
} }
#[inline] #[inline]
pub fn add_foo_union_type(&mut self, foo_union_type: namespace_b::UnionInNestedNS) { pub fn add_foo_union_type(&mut self, foo_union_type: namespace_b::UnionInNestedNS) {
self.fbb_.push_slot::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, foo_union_type, namespace_b::UnionInNestedNS::NONE); self.fbb_.push_slot::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, foo_union_type, namespace_b::UnionInNestedNS::NONE);
} }
#[inline] #[inline]
pub fn add_foo_union(&mut self, foo_union: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_foo_union(&mut self, foo_union: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TableInFirstNS::VT_FOO_UNION, foo_union); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TableInFirstNS::VT_FOO_UNION, foo_union);
} }
#[inline] #[inline]
pub fn add_foo_struct(&mut self, foo_struct: &namespace_b::StructInNestedNS) { pub fn add_foo_struct(&mut self, foo_struct: &namespace_b::StructInNestedNS) {
self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct); self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInFirstNSBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInFirstNSBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -195,6 +210,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInFirstNS<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInFirstNS<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -225,6 +241,7 @@ impl ::core::fmt::Debug for TableInFirstNS<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableInFirstNST { pub struct TableInFirstNST {
@@ -233,6 +250,7 @@ pub struct TableInFirstNST {
pub foo_union: namespace_b::UnionInNestedNST, pub foo_union: namespace_b::UnionInNestedNST,
pub foo_struct: Option<namespace_b::StructInNestedNST>, pub foo_struct: Option<namespace_b::StructInNestedNST>,
} }
impl Default for TableInFirstNST { impl Default for TableInFirstNST {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -243,6 +261,7 @@ impl Default for TableInFirstNST {
} }
} }
} }
impl TableInFirstNST { impl TableInFirstNST {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum TableInCOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum TableInCOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct TableInC<'a> { pub struct TableInC<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for TableInC<'a> { impl<'a> ::flatbuffers::Follow<'a> for TableInC<'a> {
type Inner = TableInC<'a>; type Inner = TableInC<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +31,7 @@ impl<'a> TableInC<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
TableInC { _tab: table } TableInC { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -60,6 +63,7 @@ impl<'a> TableInC<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, None)}
} }
#[inline] #[inline]
pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> { pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> {
// Safety: // Safety:
@@ -81,10 +85,12 @@ impl ::flatbuffers::Verifiable for TableInC<'_> {
Ok(()) Ok(())
} }
} }
pub struct TableInCArgs<'a> { pub struct TableInCArgs<'a> {
pub refer_to_a1: Option<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a>>>, pub refer_to_a1: Option<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a>>>,
pub refer_to_a2: Option<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a>>>, pub refer_to_a2: Option<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a>>>,
} }
impl<'a> Default for TableInCArgs<'a> { impl<'a> Default for TableInCArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -99,15 +105,18 @@ pub struct TableInCBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_refer_to_a1(&mut self, refer_to_a1: ::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) { pub fn add_refer_to_a1(&mut self, refer_to_a1: ::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1);
} }
#[inline] #[inline]
pub fn add_refer_to_a2(&mut self, refer_to_a2: ::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) { pub fn add_refer_to_a2(&mut self, refer_to_a2: ::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInCBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInCBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -116,6 +125,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInC<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInC<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -131,12 +141,14 @@ impl ::core::fmt::Debug for TableInC<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TableInCT { pub struct TableInCT {
pub refer_to_a1: Option<alloc::boxed::Box<super::namespace_a::TableInFirstNST>>, pub refer_to_a1: Option<alloc::boxed::Box<super::namespace_a::TableInFirstNST>>,
pub refer_to_a2: Option<alloc::boxed::Box<super::namespace_a::SecondTableInAT>>, pub refer_to_a2: Option<alloc::boxed::Box<super::namespace_a::SecondTableInAT>>,
} }
impl Default for TableInCT { impl Default for TableInCT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -145,6 +157,7 @@ impl Default for TableInCT {
} }
} }
} }
impl TableInCT { impl TableInCT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0; pub const ENUM_MIN_OPTIONAL_BYTE: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_OPTIONAL_BYTE: i8 = 2; pub const ENUM_MAX_OPTIONAL_BYTE: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_OPTIONAL_BYTE: [OptionalByte; 3] = [ pub const ENUM_VALUES_OPTIONAL_BYTE: [OptionalByte; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_OPTIONAL_BYTE: [OptionalByte; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct OptionalByte(pub i8); pub struct OptionalByte(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl OptionalByte { impl OptionalByte {
pub const None: Self = Self(0); pub const None: Self = Self(0);
@@ -30,6 +34,7 @@ impl OptionalByte {
Self::One, Self::One,
Self::Two, Self::Two,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl OptionalByte {
} }
} }
} }
impl ::core::fmt::Debug for OptionalByte { impl ::core::fmt::Debug for OptionalByte {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for OptionalByte {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for OptionalByte { impl<'a> ::flatbuffers::Follow<'a> for OptionalByte {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for OptionalByte {
impl ::flatbuffers::Push for OptionalByte { impl ::flatbuffers::Push for OptionalByte {
type Output = OptionalByte; type Output = OptionalByte;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for OptionalByte {
impl ::flatbuffers::EndianScalar for OptionalByte { impl ::flatbuffers::EndianScalar for OptionalByte {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum ScalarStuffOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum ScalarStuffOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ScalarStuff<'a> { pub struct ScalarStuff<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for ScalarStuff<'a> { impl<'a> ::flatbuffers::Follow<'a> for ScalarStuff<'a> {
type Inner = ScalarStuff<'a>; type Inner = ScalarStuff<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -63,6 +65,7 @@ impl<'a> ScalarStuff<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ScalarStuff { _tab: table } ScalarStuff { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -192,6 +195,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i8>(ScalarStuff::VT_JUST_I8, Some(0)).unwrap()} unsafe { self._tab.get::<i8>(ScalarStuff::VT_JUST_I8, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_i8(&self) -> Option<i8> { pub fn maybe_i8(&self) -> Option<i8> {
// Safety: // Safety:
@@ -199,6 +203,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i8>(ScalarStuff::VT_MAYBE_I8, None)} unsafe { self._tab.get::<i8>(ScalarStuff::VT_MAYBE_I8, None)}
} }
#[inline] #[inline]
pub fn default_i8(&self) -> i8 { pub fn default_i8(&self) -> i8 {
// Safety: // Safety:
@@ -206,6 +211,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i8>(ScalarStuff::VT_DEFAULT_I8, Some(42)).unwrap()} unsafe { self._tab.get::<i8>(ScalarStuff::VT_DEFAULT_I8, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_u8(&self) -> u8 { pub fn just_u8(&self) -> u8 {
// Safety: // Safety:
@@ -213,6 +219,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u8>(ScalarStuff::VT_JUST_U8, Some(0)).unwrap()} unsafe { self._tab.get::<u8>(ScalarStuff::VT_JUST_U8, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_u8(&self) -> Option<u8> { pub fn maybe_u8(&self) -> Option<u8> {
// Safety: // Safety:
@@ -220,6 +227,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u8>(ScalarStuff::VT_MAYBE_U8, None)} unsafe { self._tab.get::<u8>(ScalarStuff::VT_MAYBE_U8, None)}
} }
#[inline] #[inline]
pub fn default_u8(&self) -> u8 { pub fn default_u8(&self) -> u8 {
// Safety: // Safety:
@@ -227,6 +235,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u8>(ScalarStuff::VT_DEFAULT_U8, Some(42)).unwrap()} unsafe { self._tab.get::<u8>(ScalarStuff::VT_DEFAULT_U8, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_i16(&self) -> i16 { pub fn just_i16(&self) -> i16 {
// Safety: // Safety:
@@ -234,6 +243,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(ScalarStuff::VT_JUST_I16, Some(0)).unwrap()} unsafe { self._tab.get::<i16>(ScalarStuff::VT_JUST_I16, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_i16(&self) -> Option<i16> { pub fn maybe_i16(&self) -> Option<i16> {
// Safety: // Safety:
@@ -241,6 +251,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(ScalarStuff::VT_MAYBE_I16, None)} unsafe { self._tab.get::<i16>(ScalarStuff::VT_MAYBE_I16, None)}
} }
#[inline] #[inline]
pub fn default_i16(&self) -> i16 { pub fn default_i16(&self) -> i16 {
// Safety: // Safety:
@@ -248,6 +259,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i16>(ScalarStuff::VT_DEFAULT_I16, Some(42)).unwrap()} unsafe { self._tab.get::<i16>(ScalarStuff::VT_DEFAULT_I16, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_u16(&self) -> u16 { pub fn just_u16(&self) -> u16 {
// Safety: // Safety:
@@ -255,6 +267,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(ScalarStuff::VT_JUST_U16, Some(0)).unwrap()} unsafe { self._tab.get::<u16>(ScalarStuff::VT_JUST_U16, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_u16(&self) -> Option<u16> { pub fn maybe_u16(&self) -> Option<u16> {
// Safety: // Safety:
@@ -262,6 +275,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(ScalarStuff::VT_MAYBE_U16, None)} unsafe { self._tab.get::<u16>(ScalarStuff::VT_MAYBE_U16, None)}
} }
#[inline] #[inline]
pub fn default_u16(&self) -> u16 { pub fn default_u16(&self) -> u16 {
// Safety: // Safety:
@@ -269,6 +283,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u16>(ScalarStuff::VT_DEFAULT_U16, Some(42)).unwrap()} unsafe { self._tab.get::<u16>(ScalarStuff::VT_DEFAULT_U16, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_i32(&self) -> i32 { pub fn just_i32(&self) -> i32 {
// Safety: // Safety:
@@ -276,6 +291,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(ScalarStuff::VT_JUST_I32, Some(0)).unwrap()} unsafe { self._tab.get::<i32>(ScalarStuff::VT_JUST_I32, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_i32(&self) -> Option<i32> { pub fn maybe_i32(&self) -> Option<i32> {
// Safety: // Safety:
@@ -283,6 +299,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(ScalarStuff::VT_MAYBE_I32, None)} unsafe { self._tab.get::<i32>(ScalarStuff::VT_MAYBE_I32, None)}
} }
#[inline] #[inline]
pub fn default_i32(&self) -> i32 { pub fn default_i32(&self) -> i32 {
// Safety: // Safety:
@@ -290,6 +307,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i32>(ScalarStuff::VT_DEFAULT_I32, Some(42)).unwrap()} unsafe { self._tab.get::<i32>(ScalarStuff::VT_DEFAULT_I32, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_u32(&self) -> u32 { pub fn just_u32(&self) -> u32 {
// Safety: // Safety:
@@ -297,6 +315,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(ScalarStuff::VT_JUST_U32, Some(0)).unwrap()} unsafe { self._tab.get::<u32>(ScalarStuff::VT_JUST_U32, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_u32(&self) -> Option<u32> { pub fn maybe_u32(&self) -> Option<u32> {
// Safety: // Safety:
@@ -304,6 +323,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(ScalarStuff::VT_MAYBE_U32, None)} unsafe { self._tab.get::<u32>(ScalarStuff::VT_MAYBE_U32, None)}
} }
#[inline] #[inline]
pub fn default_u32(&self) -> u32 { pub fn default_u32(&self) -> u32 {
// Safety: // Safety:
@@ -311,6 +331,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u32>(ScalarStuff::VT_DEFAULT_U32, Some(42)).unwrap()} unsafe { self._tab.get::<u32>(ScalarStuff::VT_DEFAULT_U32, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_i64(&self) -> i64 { pub fn just_i64(&self) -> i64 {
// Safety: // Safety:
@@ -318,6 +339,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(ScalarStuff::VT_JUST_I64, Some(0)).unwrap()} unsafe { self._tab.get::<i64>(ScalarStuff::VT_JUST_I64, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_i64(&self) -> Option<i64> { pub fn maybe_i64(&self) -> Option<i64> {
// Safety: // Safety:
@@ -325,6 +347,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(ScalarStuff::VT_MAYBE_I64, None)} unsafe { self._tab.get::<i64>(ScalarStuff::VT_MAYBE_I64, None)}
} }
#[inline] #[inline]
pub fn default_i64(&self) -> i64 { pub fn default_i64(&self) -> i64 {
// Safety: // Safety:
@@ -332,6 +355,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<i64>(ScalarStuff::VT_DEFAULT_I64, Some(42)).unwrap()} unsafe { self._tab.get::<i64>(ScalarStuff::VT_DEFAULT_I64, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_u64(&self) -> u64 { pub fn just_u64(&self) -> u64 {
// Safety: // Safety:
@@ -339,6 +363,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(ScalarStuff::VT_JUST_U64, Some(0)).unwrap()} unsafe { self._tab.get::<u64>(ScalarStuff::VT_JUST_U64, Some(0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_u64(&self) -> Option<u64> { pub fn maybe_u64(&self) -> Option<u64> {
// Safety: // Safety:
@@ -346,6 +371,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(ScalarStuff::VT_MAYBE_U64, None)} unsafe { self._tab.get::<u64>(ScalarStuff::VT_MAYBE_U64, None)}
} }
#[inline] #[inline]
pub fn default_u64(&self) -> u64 { pub fn default_u64(&self) -> u64 {
// Safety: // Safety:
@@ -353,6 +379,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<u64>(ScalarStuff::VT_DEFAULT_U64, Some(42)).unwrap()} unsafe { self._tab.get::<u64>(ScalarStuff::VT_DEFAULT_U64, Some(42)).unwrap()}
} }
#[inline] #[inline]
pub fn just_f32(&self) -> f32 { pub fn just_f32(&self) -> f32 {
// Safety: // Safety:
@@ -360,6 +387,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(ScalarStuff::VT_JUST_F32, Some(0.0)).unwrap()} unsafe { self._tab.get::<f32>(ScalarStuff::VT_JUST_F32, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_f32(&self) -> Option<f32> { pub fn maybe_f32(&self) -> Option<f32> {
// Safety: // Safety:
@@ -367,6 +395,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(ScalarStuff::VT_MAYBE_F32, None)} unsafe { self._tab.get::<f32>(ScalarStuff::VT_MAYBE_F32, None)}
} }
#[inline] #[inline]
pub fn default_f32(&self) -> f32 { pub fn default_f32(&self) -> f32 {
// Safety: // Safety:
@@ -374,6 +403,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f32>(ScalarStuff::VT_DEFAULT_F32, Some(42.0)).unwrap()} unsafe { self._tab.get::<f32>(ScalarStuff::VT_DEFAULT_F32, Some(42.0)).unwrap()}
} }
#[inline] #[inline]
pub fn just_f64(&self) -> f64 { pub fn just_f64(&self) -> f64 {
// Safety: // Safety:
@@ -381,6 +411,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(ScalarStuff::VT_JUST_F64, Some(0.0)).unwrap()} unsafe { self._tab.get::<f64>(ScalarStuff::VT_JUST_F64, Some(0.0)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_f64(&self) -> Option<f64> { pub fn maybe_f64(&self) -> Option<f64> {
// Safety: // Safety:
@@ -388,6 +419,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(ScalarStuff::VT_MAYBE_F64, None)} unsafe { self._tab.get::<f64>(ScalarStuff::VT_MAYBE_F64, None)}
} }
#[inline] #[inline]
pub fn default_f64(&self) -> f64 { pub fn default_f64(&self) -> f64 {
// Safety: // Safety:
@@ -395,6 +427,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<f64>(ScalarStuff::VT_DEFAULT_F64, Some(42.0)).unwrap()} unsafe { self._tab.get::<f64>(ScalarStuff::VT_DEFAULT_F64, Some(42.0)).unwrap()}
} }
#[inline] #[inline]
pub fn just_bool(&self) -> bool { pub fn just_bool(&self) -> bool {
// Safety: // Safety:
@@ -402,6 +435,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<bool>(ScalarStuff::VT_JUST_BOOL, Some(false)).unwrap()} unsafe { self._tab.get::<bool>(ScalarStuff::VT_JUST_BOOL, Some(false)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_bool(&self) -> Option<bool> { pub fn maybe_bool(&self) -> Option<bool> {
// Safety: // Safety:
@@ -409,6 +443,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<bool>(ScalarStuff::VT_MAYBE_BOOL, None)} unsafe { self._tab.get::<bool>(ScalarStuff::VT_MAYBE_BOOL, None)}
} }
#[inline] #[inline]
pub fn default_bool(&self) -> bool { pub fn default_bool(&self) -> bool {
// Safety: // Safety:
@@ -416,6 +451,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<bool>(ScalarStuff::VT_DEFAULT_BOOL, Some(true)).unwrap()} unsafe { self._tab.get::<bool>(ScalarStuff::VT_DEFAULT_BOOL, Some(true)).unwrap()}
} }
#[inline] #[inline]
pub fn just_enum(&self) -> OptionalByte { pub fn just_enum(&self) -> OptionalByte {
// Safety: // Safety:
@@ -423,6 +459,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, Some(OptionalByte::None)).unwrap()} unsafe { self._tab.get::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, Some(OptionalByte::None)).unwrap()}
} }
#[inline] #[inline]
pub fn maybe_enum(&self) -> Option<OptionalByte> { pub fn maybe_enum(&self) -> Option<OptionalByte> {
// Safety: // Safety:
@@ -430,6 +467,7 @@ impl<'a> ScalarStuff<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, None)} unsafe { self._tab.get::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, None)}
} }
#[inline] #[inline]
pub fn default_enum(&self) -> OptionalByte { pub fn default_enum(&self) -> OptionalByte {
// Safety: // Safety:
@@ -485,6 +523,7 @@ impl ::flatbuffers::Verifiable for ScalarStuff<'_> {
Ok(()) Ok(())
} }
} }
pub struct ScalarStuffArgs { pub struct ScalarStuffArgs {
pub just_i8: i8, pub just_i8: i8,
pub maybe_i8: Option<i8>, pub maybe_i8: Option<i8>,
@@ -523,6 +562,7 @@ pub struct ScalarStuffArgs {
pub maybe_enum: Option<OptionalByte>, pub maybe_enum: Option<OptionalByte>,
pub default_enum: OptionalByte, pub default_enum: OptionalByte,
} }
impl<'a> Default for ScalarStuffArgs { impl<'a> Default for ScalarStuffArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -571,151 +611,188 @@ pub struct ScalarStuffBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_just_i8(&mut self, just_i8: i8) { pub fn add_just_i8(&mut self, just_i8: i8) {
self.fbb_.push_slot::<i8>(ScalarStuff::VT_JUST_I8, just_i8, 0); self.fbb_.push_slot::<i8>(ScalarStuff::VT_JUST_I8, just_i8, 0);
} }
#[inline] #[inline]
pub fn add_maybe_i8(&mut self, maybe_i8: i8) { pub fn add_maybe_i8(&mut self, maybe_i8: i8) {
self.fbb_.push_slot_always::<i8>(ScalarStuff::VT_MAYBE_I8, maybe_i8); self.fbb_.push_slot_always::<i8>(ScalarStuff::VT_MAYBE_I8, maybe_i8);
} }
#[inline] #[inline]
pub fn add_default_i8(&mut self, default_i8: i8) { pub fn add_default_i8(&mut self, default_i8: i8) {
self.fbb_.push_slot::<i8>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42); self.fbb_.push_slot::<i8>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42);
} }
#[inline] #[inline]
pub fn add_just_u8(&mut self, just_u8: u8) { pub fn add_just_u8(&mut self, just_u8: u8) {
self.fbb_.push_slot::<u8>(ScalarStuff::VT_JUST_U8, just_u8, 0); self.fbb_.push_slot::<u8>(ScalarStuff::VT_JUST_U8, just_u8, 0);
} }
#[inline] #[inline]
pub fn add_maybe_u8(&mut self, maybe_u8: u8) { pub fn add_maybe_u8(&mut self, maybe_u8: u8) {
self.fbb_.push_slot_always::<u8>(ScalarStuff::VT_MAYBE_U8, maybe_u8); self.fbb_.push_slot_always::<u8>(ScalarStuff::VT_MAYBE_U8, maybe_u8);
} }
#[inline] #[inline]
pub fn add_default_u8(&mut self, default_u8: u8) { pub fn add_default_u8(&mut self, default_u8: u8) {
self.fbb_.push_slot::<u8>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42); self.fbb_.push_slot::<u8>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42);
} }
#[inline] #[inline]
pub fn add_just_i16(&mut self, just_i16: i16) { pub fn add_just_i16(&mut self, just_i16: i16) {
self.fbb_.push_slot::<i16>(ScalarStuff::VT_JUST_I16, just_i16, 0); self.fbb_.push_slot::<i16>(ScalarStuff::VT_JUST_I16, just_i16, 0);
} }
#[inline] #[inline]
pub fn add_maybe_i16(&mut self, maybe_i16: i16) { pub fn add_maybe_i16(&mut self, maybe_i16: i16) {
self.fbb_.push_slot_always::<i16>(ScalarStuff::VT_MAYBE_I16, maybe_i16); self.fbb_.push_slot_always::<i16>(ScalarStuff::VT_MAYBE_I16, maybe_i16);
} }
#[inline] #[inline]
pub fn add_default_i16(&mut self, default_i16: i16) { pub fn add_default_i16(&mut self, default_i16: i16) {
self.fbb_.push_slot::<i16>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42); self.fbb_.push_slot::<i16>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42);
} }
#[inline] #[inline]
pub fn add_just_u16(&mut self, just_u16: u16) { pub fn add_just_u16(&mut self, just_u16: u16) {
self.fbb_.push_slot::<u16>(ScalarStuff::VT_JUST_U16, just_u16, 0); self.fbb_.push_slot::<u16>(ScalarStuff::VT_JUST_U16, just_u16, 0);
} }
#[inline] #[inline]
pub fn add_maybe_u16(&mut self, maybe_u16: u16) { pub fn add_maybe_u16(&mut self, maybe_u16: u16) {
self.fbb_.push_slot_always::<u16>(ScalarStuff::VT_MAYBE_U16, maybe_u16); self.fbb_.push_slot_always::<u16>(ScalarStuff::VT_MAYBE_U16, maybe_u16);
} }
#[inline] #[inline]
pub fn add_default_u16(&mut self, default_u16: u16) { pub fn add_default_u16(&mut self, default_u16: u16) {
self.fbb_.push_slot::<u16>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42); self.fbb_.push_slot::<u16>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42);
} }
#[inline] #[inline]
pub fn add_just_i32(&mut self, just_i32: i32) { pub fn add_just_i32(&mut self, just_i32: i32) {
self.fbb_.push_slot::<i32>(ScalarStuff::VT_JUST_I32, just_i32, 0); self.fbb_.push_slot::<i32>(ScalarStuff::VT_JUST_I32, just_i32, 0);
} }
#[inline] #[inline]
pub fn add_maybe_i32(&mut self, maybe_i32: i32) { pub fn add_maybe_i32(&mut self, maybe_i32: i32) {
self.fbb_.push_slot_always::<i32>(ScalarStuff::VT_MAYBE_I32, maybe_i32); self.fbb_.push_slot_always::<i32>(ScalarStuff::VT_MAYBE_I32, maybe_i32);
} }
#[inline] #[inline]
pub fn add_default_i32(&mut self, default_i32: i32) { pub fn add_default_i32(&mut self, default_i32: i32) {
self.fbb_.push_slot::<i32>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42); self.fbb_.push_slot::<i32>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42);
} }
#[inline] #[inline]
pub fn add_just_u32(&mut self, just_u32: u32) { pub fn add_just_u32(&mut self, just_u32: u32) {
self.fbb_.push_slot::<u32>(ScalarStuff::VT_JUST_U32, just_u32, 0); self.fbb_.push_slot::<u32>(ScalarStuff::VT_JUST_U32, just_u32, 0);
} }
#[inline] #[inline]
pub fn add_maybe_u32(&mut self, maybe_u32: u32) { pub fn add_maybe_u32(&mut self, maybe_u32: u32) {
self.fbb_.push_slot_always::<u32>(ScalarStuff::VT_MAYBE_U32, maybe_u32); self.fbb_.push_slot_always::<u32>(ScalarStuff::VT_MAYBE_U32, maybe_u32);
} }
#[inline] #[inline]
pub fn add_default_u32(&mut self, default_u32: u32) { pub fn add_default_u32(&mut self, default_u32: u32) {
self.fbb_.push_slot::<u32>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42); self.fbb_.push_slot::<u32>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42);
} }
#[inline] #[inline]
pub fn add_just_i64(&mut self, just_i64: i64) { pub fn add_just_i64(&mut self, just_i64: i64) {
self.fbb_.push_slot::<i64>(ScalarStuff::VT_JUST_I64, just_i64, 0); self.fbb_.push_slot::<i64>(ScalarStuff::VT_JUST_I64, just_i64, 0);
} }
#[inline] #[inline]
pub fn add_maybe_i64(&mut self, maybe_i64: i64) { pub fn add_maybe_i64(&mut self, maybe_i64: i64) {
self.fbb_.push_slot_always::<i64>(ScalarStuff::VT_MAYBE_I64, maybe_i64); self.fbb_.push_slot_always::<i64>(ScalarStuff::VT_MAYBE_I64, maybe_i64);
} }
#[inline] #[inline]
pub fn add_default_i64(&mut self, default_i64: i64) { pub fn add_default_i64(&mut self, default_i64: i64) {
self.fbb_.push_slot::<i64>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42); self.fbb_.push_slot::<i64>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42);
} }
#[inline] #[inline]
pub fn add_just_u64(&mut self, just_u64: u64) { pub fn add_just_u64(&mut self, just_u64: u64) {
self.fbb_.push_slot::<u64>(ScalarStuff::VT_JUST_U64, just_u64, 0); self.fbb_.push_slot::<u64>(ScalarStuff::VT_JUST_U64, just_u64, 0);
} }
#[inline] #[inline]
pub fn add_maybe_u64(&mut self, maybe_u64: u64) { pub fn add_maybe_u64(&mut self, maybe_u64: u64) {
self.fbb_.push_slot_always::<u64>(ScalarStuff::VT_MAYBE_U64, maybe_u64); self.fbb_.push_slot_always::<u64>(ScalarStuff::VT_MAYBE_U64, maybe_u64);
} }
#[inline] #[inline]
pub fn add_default_u64(&mut self, default_u64: u64) { pub fn add_default_u64(&mut self, default_u64: u64) {
self.fbb_.push_slot::<u64>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42); self.fbb_.push_slot::<u64>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42);
} }
#[inline] #[inline]
pub fn add_just_f32(&mut self, just_f32: f32) { pub fn add_just_f32(&mut self, just_f32: f32) {
self.fbb_.push_slot::<f32>(ScalarStuff::VT_JUST_F32, just_f32, 0.0); self.fbb_.push_slot::<f32>(ScalarStuff::VT_JUST_F32, just_f32, 0.0);
} }
#[inline] #[inline]
pub fn add_maybe_f32(&mut self, maybe_f32: f32) { pub fn add_maybe_f32(&mut self, maybe_f32: f32) {
self.fbb_.push_slot_always::<f32>(ScalarStuff::VT_MAYBE_F32, maybe_f32); self.fbb_.push_slot_always::<f32>(ScalarStuff::VT_MAYBE_F32, maybe_f32);
} }
#[inline] #[inline]
pub fn add_default_f32(&mut self, default_f32: f32) { pub fn add_default_f32(&mut self, default_f32: f32) {
self.fbb_.push_slot::<f32>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0); self.fbb_.push_slot::<f32>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0);
} }
#[inline] #[inline]
pub fn add_just_f64(&mut self, just_f64: f64) { pub fn add_just_f64(&mut self, just_f64: f64) {
self.fbb_.push_slot::<f64>(ScalarStuff::VT_JUST_F64, just_f64, 0.0); self.fbb_.push_slot::<f64>(ScalarStuff::VT_JUST_F64, just_f64, 0.0);
} }
#[inline] #[inline]
pub fn add_maybe_f64(&mut self, maybe_f64: f64) { pub fn add_maybe_f64(&mut self, maybe_f64: f64) {
self.fbb_.push_slot_always::<f64>(ScalarStuff::VT_MAYBE_F64, maybe_f64); self.fbb_.push_slot_always::<f64>(ScalarStuff::VT_MAYBE_F64, maybe_f64);
} }
#[inline] #[inline]
pub fn add_default_f64(&mut self, default_f64: f64) { pub fn add_default_f64(&mut self, default_f64: f64) {
self.fbb_.push_slot::<f64>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0); self.fbb_.push_slot::<f64>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0);
} }
#[inline] #[inline]
pub fn add_just_bool(&mut self, just_bool: bool) { pub fn add_just_bool(&mut self, just_bool: bool) {
self.fbb_.push_slot::<bool>(ScalarStuff::VT_JUST_BOOL, just_bool, false); self.fbb_.push_slot::<bool>(ScalarStuff::VT_JUST_BOOL, just_bool, false);
} }
#[inline] #[inline]
pub fn add_maybe_bool(&mut self, maybe_bool: bool) { pub fn add_maybe_bool(&mut self, maybe_bool: bool) {
self.fbb_.push_slot_always::<bool>(ScalarStuff::VT_MAYBE_BOOL, maybe_bool); self.fbb_.push_slot_always::<bool>(ScalarStuff::VT_MAYBE_BOOL, maybe_bool);
} }
#[inline] #[inline]
pub fn add_default_bool(&mut self, default_bool: bool) { pub fn add_default_bool(&mut self, default_bool: bool) {
self.fbb_.push_slot::<bool>(ScalarStuff::VT_DEFAULT_BOOL, default_bool, true); self.fbb_.push_slot::<bool>(ScalarStuff::VT_DEFAULT_BOOL, default_bool, true);
} }
#[inline] #[inline]
pub fn add_just_enum(&mut self, just_enum: OptionalByte) { pub fn add_just_enum(&mut self, just_enum: OptionalByte) {
self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, just_enum, OptionalByte::None); self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_JUST_ENUM, just_enum, OptionalByte::None);
} }
#[inline] #[inline]
pub fn add_maybe_enum(&mut self, maybe_enum: OptionalByte) { pub fn add_maybe_enum(&mut self, maybe_enum: OptionalByte) {
self.fbb_.push_slot_always::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, maybe_enum); self.fbb_.push_slot_always::<OptionalByte>(ScalarStuff::VT_MAYBE_ENUM, maybe_enum);
} }
#[inline] #[inline]
pub fn add_default_enum(&mut self, default_enum: OptionalByte) { pub fn add_default_enum(&mut self, default_enum: OptionalByte) {
self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, default_enum, OptionalByte::One); self.fbb_.push_slot::<OptionalByte>(ScalarStuff::VT_DEFAULT_ENUM, default_enum, OptionalByte::One);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ScalarStuffBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ScalarStuffBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -724,6 +801,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ScalarStuffBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<ScalarStuff<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<ScalarStuff<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -773,6 +851,7 @@ impl ::core::fmt::Debug for ScalarStuff<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct ScalarStuffT { pub struct ScalarStuffT {
@@ -813,6 +892,7 @@ pub struct ScalarStuffT {
pub maybe_enum: Option<OptionalByte>, pub maybe_enum: Option<OptionalByte>,
pub default_enum: OptionalByte, pub default_enum: OptionalByte,
} }
impl Default for ScalarStuffT { impl Default for ScalarStuffT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -855,6 +935,7 @@ impl Default for ScalarStuffT {
} }
} }
} }
impl ScalarStuffT { impl ScalarStuffT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,
@@ -936,66 +1017,73 @@ impl ScalarStuffT {
}) })
} }
} }
#[inline]
/// Verifies that a buffer of bytes contains a `ScalarStuff` /// Verifies that a buffer of bytes contains a `ScalarStuff`
/// and returns it. /// and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`. /// `root_as_scalar_stuff_unchecked`.
#[inline]
pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<ScalarStuff>(buf) ::flatbuffers::root::<ScalarStuff>(buf)
} }
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed /// Verifies that a buffer of bytes contains a size prefixed
/// `ScalarStuff` and returns it. /// `ScalarStuff` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `size_prefixed_root_as_scalar_stuff_unchecked`. /// `size_prefixed_root_as_scalar_stuff_unchecked`.
#[inline]
pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> { pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<ScalarStuff>(buf) ::flatbuffers::size_prefixed_root::<ScalarStuff>(buf)
} }
#[inline]
/// Verifies, with the given options, that a buffer of bytes /// Verifies, with the given options, that a buffer of bytes
/// contains a `ScalarStuff` and returns it. /// contains a `ScalarStuff` and returns it.
/// Note that verification is still experimental and may not /// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`. /// `root_as_scalar_stuff_unchecked`.
#[inline]
pub fn root_as_scalar_stuff_with_opts<'b, 'o>( pub fn root_as_scalar_stuff_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<ScalarStuff<'b>>(opts, buf) ::flatbuffers::root_with_opts::<ScalarStuff<'b>>(opts, buf)
} }
#[inline]
/// Verifies, with the given verifier options, that a buffer of /// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `ScalarStuff` and returns /// bytes contains a size prefixed `ScalarStuff` and returns
/// it. Note that verification is still experimental and may not /// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the /// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use /// previous, unchecked, behavior use
/// `root_as_scalar_stuff_unchecked`. /// `root_as_scalar_stuff_unchecked`.
#[inline]
pub fn size_prefixed_root_as_scalar_stuff_with_opts<'b, 'o>( pub fn size_prefixed_root_as_scalar_stuff_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions, opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8], buf: &'b [u8],
) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> { ) -> Result<ScalarStuff<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<ScalarStuff<'b>>(opts, buf) ::flatbuffers::size_prefixed_root_with_opts::<ScalarStuff<'b>>(opts, buf)
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a ScalarStuff and returns it. /// Assumes, without verification, that a buffer of bytes contains a ScalarStuff and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid `ScalarStuff`. /// Callers must trust the given bytes do indeed contain a valid `ScalarStuff`.
#[inline]
pub unsafe fn root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> { pub unsafe fn root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> {
unsafe { ::flatbuffers::root_unchecked::<ScalarStuff>(buf) } unsafe { ::flatbuffers::root_unchecked::<ScalarStuff>(buf) }
} }
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ScalarStuff and returns it. /// Assumes, without verification, that a buffer of bytes contains a size prefixed ScalarStuff and returns it.
/// # Safety /// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ScalarStuff`. /// Callers must trust the given bytes do indeed contain a valid size prefixed `ScalarStuff`.
#[inline]
pub unsafe fn size_prefixed_root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> { pub unsafe fn size_prefixed_root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) } unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) }
} }
pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL"; pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL";
#[inline] #[inline]

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_AB: i8 = 0; pub const ENUM_MIN_AB: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_AB: i8 = 1; pub const ENUM_MAX_AB: i8 = 1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_AB: [AB; 2] = [ pub const ENUM_VALUES_AB: [AB; 2] = [
@@ -16,6 +19,7 @@ pub const ENUM_VALUES_AB: [AB; 2] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub(crate) struct AB(pub i8); pub(crate) struct AB(pub i8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl AB { impl AB {
pub const A: Self = Self(0); pub const A: Self = Self(0);
@@ -27,6 +31,7 @@ impl AB {
Self::A, Self::A,
Self::B, Self::B,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -36,6 +41,7 @@ impl AB {
} }
} }
} }
impl ::core::fmt::Debug for AB { impl ::core::fmt::Debug for AB {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -45,8 +51,10 @@ impl ::core::fmt::Debug for AB {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for AB { impl<'a> ::flatbuffers::Follow<'a> for AB {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
@@ -56,6 +64,7 @@ impl<'a> ::flatbuffers::Follow<'a> for AB {
impl ::flatbuffers::Push for AB { impl ::flatbuffers::Push for AB {
type Output = AB; type Output = AB;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
@@ -64,10 +73,12 @@ impl ::flatbuffers::Push for AB {
impl ::flatbuffers::EndianScalar for AB { impl ::flatbuffers::EndianScalar for AB {
type Scalar = i8; type Scalar = i8;
#[inline] #[inline]
fn to_little_endian(self) -> i8 { fn to_little_endian(self) -> i8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self { fn from_little_endian(v: i8) -> Self {

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub(crate) enum AnnotationsOffset {}
#[derive(Copy, Clone, PartialEq)]
pub(crate) enum AnnotationsOffset {}
#[derive(Copy, Clone, PartialEq)]
pub(crate) struct Annotations<'a> { pub(crate) struct Annotations<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Annotations<'a> { impl<'a> ::flatbuffers::Follow<'a> for Annotations<'a> {
type Inner = Annotations<'a>; type Inner = Annotations<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> Annotations<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Annotations { _tab: table } Annotations { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -65,9 +68,11 @@ impl ::flatbuffers::Verifiable for Annotations<'_> {
Ok(()) Ok(())
} }
} }
pub(crate) struct AnnotationsArgs { pub(crate) struct AnnotationsArgs {
pub value: i32, pub value: i32,
} }
impl<'a> Default for AnnotationsArgs { impl<'a> Default for AnnotationsArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -81,11 +86,13 @@ pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + '
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_value(&mut self, value: i32) { pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0); self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -94,6 +101,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Annotations<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Annotations<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -108,11 +116,13 @@ impl ::core::fmt::Debug for Annotations<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub(crate) struct AnnotationsT { pub(crate) struct AnnotationsT {
pub value: i32, pub value: i32,
} }
impl Default for AnnotationsT { impl Default for AnnotationsT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -120,6 +130,7 @@ impl Default for AnnotationsT {
} }
} }
} }
impl AnnotationsT { impl AnnotationsT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_ANY: u8 = 0; pub const ENUM_MIN_ANY: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_ANY: u8 = 2; pub const ENUM_MAX_ANY: u8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY: [Any; 3] = [ pub const ENUM_VALUES_ANY: [Any; 3] = [
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_ANY: [Any; 3] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub(crate) struct Any(pub u8); pub(crate) struct Any(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl Any { impl Any {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -30,6 +34,7 @@ impl Any {
Self::Game, Self::Game,
Self::Annotations, Self::Annotations,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -40,6 +45,7 @@ impl Any {
} }
} }
} }
impl ::core::fmt::Debug for Any { impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for Any {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for Any { impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for Any {
impl ::flatbuffers::Push for Any { impl ::flatbuffers::Push for Any {
type Output = Any; type Output = Any;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for Any {
impl ::flatbuffers::EndianScalar for Any { impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -90,6 +101,7 @@ impl<'a> ::flatbuffers::Verifiable for Any {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Any {} impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
pub(crate) struct AnyUnionTableOffset {} pub(crate) struct AnyUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -100,11 +112,13 @@ pub(crate) enum AnyT {
Game(alloc::boxed::Box<GameT>), Game(alloc::boxed::Box<GameT>),
Annotations(alloc::boxed::Box<AnnotationsT>), Annotations(alloc::boxed::Box<AnnotationsT>),
} }
impl Default for AnyT { impl Default for AnyT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl AnyT { impl AnyT {
pub fn any_type(&self) -> Any { pub fn any_type(&self) -> Any {
match self { match self {
@@ -113,6 +127,7 @@ impl AnyT {
Self::Annotations(_) => Any::Annotations, Self::Annotations(_) => Any::Annotations,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -120,6 +135,7 @@ impl AnyT {
Self::Annotations(v) => Some(v.pack(fbb).as_union_value()), Self::Annotations(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned GameT, setting the union to NONE. /// If the union variant matches, return the owned GameT, setting the union to NONE.
pub fn take_game(&mut self) -> Option<alloc::boxed::Box<GameT>> { pub fn take_game(&mut self) -> Option<alloc::boxed::Box<GameT>> {
if let Self::Game(_) = self { if let Self::Game(_) = self {
@@ -133,14 +149,17 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the GameT. /// If the union variant matches, return a reference to the GameT.
pub fn as_game(&self) -> Option<&GameT> { pub fn as_game(&self) -> Option<&GameT> {
if let Self::Game(v) = self { Some(v.as_ref()) } else { None } if let Self::Game(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the GameT. /// If the union variant matches, return a mutable reference to the GameT.
pub fn as_game_mut(&mut self) -> Option<&mut GameT> { pub fn as_game_mut(&mut self) -> Option<&mut GameT> {
if let Self::Game(v) = self { Some(v.as_mut()) } else { None } if let Self::Game(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned AnnotationsT, setting the union to NONE. /// If the union variant matches, return the owned AnnotationsT, setting the union to NONE.
pub fn take_annotations(&mut self) -> Option<alloc::boxed::Box<AnnotationsT>> { pub fn take_annotations(&mut self) -> Option<alloc::boxed::Box<AnnotationsT>> {
if let Self::Annotations(_) = self { if let Self::Annotations(_) = self {
@@ -154,12 +173,15 @@ impl AnyT {
None None
} }
} }
/// If the union variant matches, return a reference to the AnnotationsT. /// If the union variant matches, return a reference to the AnnotationsT.
pub fn as_annotations(&self) -> Option<&AnnotationsT> { pub fn as_annotations(&self) -> Option<&AnnotationsT> {
if let Self::Annotations(v) = self { Some(v.as_ref()) } else { None } if let Self::Annotations(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the AnnotationsT. /// If the union variant matches, return a mutable reference to the AnnotationsT.
pub fn as_annotations_mut(&mut self) -> Option<&mut AnnotationsT> { pub fn as_annotations_mut(&mut self) -> Option<&mut AnnotationsT> {
if let Self::Annotations(v) = self { Some(v.as_mut()) } else { None } if let Self::Annotations(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub(crate) enum GameOffset {}
#[derive(Copy, Clone, PartialEq)]
pub(crate) enum GameOffset {}
#[derive(Copy, Clone, PartialEq)]
pub(crate) struct Game<'a> { pub(crate) struct Game<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for Game<'a> { impl<'a> ::flatbuffers::Follow<'a> for Game<'a> {
type Inner = Game<'a>; type Inner = Game<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -28,6 +30,7 @@ impl<'a> Game<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Game { _tab: table } Game { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -65,9 +68,11 @@ impl ::flatbuffers::Verifiable for Game<'_> {
Ok(()) Ok(())
} }
} }
pub(crate) struct GameArgs { pub(crate) struct GameArgs {
pub value: i32, pub value: i32,
} }
impl<'a> Default for GameArgs { impl<'a> Default for GameArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -81,11 +86,13 @@ pub(crate) struct GameBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_value(&mut self, value: i32) { pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0); self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -94,6 +101,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Game<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<Game<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -108,11 +116,13 @@ impl ::core::fmt::Debug for Game<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub(crate) struct GameT { pub(crate) struct GameT {
pub value: i32, pub value: i32,
} }
impl Default for GameT { impl Default for GameT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -120,6 +130,7 @@ impl Default for GameT {
} }
} }
} }
impl GameT { impl GameT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct Object, aligned to 4 // struct Object, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub(crate) struct Object(pub [u8; 4]); pub(crate) struct Object(pub [u8; 4]);
impl Default for Object { impl Default for Object {
fn default() -> Self { fn default() -> Self {
Self([0; 4]) Self([0; 4])
} }
} }
impl ::core::fmt::Debug for Object { impl ::core::fmt::Debug for Object {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Object") f.debug_struct("Object")
@@ -20,27 +23,34 @@ impl ::core::fmt::Debug for Object {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for Object {} impl ::flatbuffers::SimpleToVerifyInSlice for Object {}
impl<'a> ::flatbuffers::Follow<'a> for Object { impl<'a> ::flatbuffers::Follow<'a> for Object {
type Inner = &'a Object; type Inner = &'a Object;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Object>::follow(buf, loc) } unsafe { <&'a Object>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a Object { impl<'a> ::flatbuffers::Follow<'a> for &'a Object {
type Inner = &'a Object; type Inner = &'a Object;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Object>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<Object>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for Object { impl<'b> ::flatbuffers::Push for Object {
type Output = Object; type Output = Object;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Object as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const Object as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -110,6 +120,7 @@ impl<'a> Object {
pub(crate) struct ObjectT { pub(crate) struct ObjectT {
pub value: i32, pub value: i32,
} }
impl ObjectT { impl ObjectT {
pub fn pack(&self) -> Object { pub fn pack(&self) -> Object {
Object::new( Object::new(
@@ -117,4 +128,3 @@ impl ObjectT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum FieldTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum FieldTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct FieldTable<'a> { pub struct FieldTable<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for FieldTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for FieldTable<'a> {
type Inner = FieldTable<'a>; type Inner = FieldTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for FieldTable<'a> {
} }
impl<'a> FieldTable<'a> { impl<'a> FieldTable<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"RustNamerTest.FieldTable" "RustNamerTest.FieldTable"
} }
@@ -27,6 +28,7 @@ impl<'a> FieldTable<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
FieldTable { _tab: table } FieldTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for FieldTable<'_> {
Ok(()) Ok(())
} }
} }
pub struct FieldTableArgs { pub struct FieldTableArgs {
} }
impl<'a> Default for FieldTableArgs { impl<'a> Default for FieldTableArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -66,6 +70,7 @@ pub struct FieldTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> FieldTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> FieldTableBuilder<'a, 'b, A> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A>
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<FieldTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<FieldTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for FieldTable<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct FieldTableT { pub struct FieldTableT {
} }
impl Default for FieldTableT { impl Default for FieldTableT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl FieldTableT { impl FieldTableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_FIELD_UNION: u8 = 0; pub const ENUM_MIN_FIELD_UNION: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_FIELD_UNION: u8 = 1; pub const ENUM_MAX_FIELD_UNION: u8 = 1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_FIELD_UNION: [FieldUnion; 2] = [ pub const ENUM_VALUES_FIELD_UNION: [FieldUnion; 2] = [
@@ -16,6 +19,7 @@ pub const ENUM_VALUES_FIELD_UNION: [FieldUnion; 2] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct FieldUnion(pub u8); pub struct FieldUnion(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl FieldUnion { impl FieldUnion {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -27,6 +31,7 @@ impl FieldUnion {
Self::NONE, Self::NONE,
Self::f, Self::f,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -36,6 +41,7 @@ impl FieldUnion {
} }
} }
} }
impl ::core::fmt::Debug for FieldUnion { impl ::core::fmt::Debug for FieldUnion {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -45,8 +51,10 @@ impl ::core::fmt::Debug for FieldUnion {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for FieldUnion { impl<'a> ::flatbuffers::Follow<'a> for FieldUnion {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -56,6 +64,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FieldUnion {
impl ::flatbuffers::Push for FieldUnion { impl ::flatbuffers::Push for FieldUnion {
type Output = FieldUnion; type Output = FieldUnion;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -64,10 +73,12 @@ impl ::flatbuffers::Push for FieldUnion {
impl ::flatbuffers::EndianScalar for FieldUnion { impl ::flatbuffers::EndianScalar for FieldUnion {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -86,6 +97,7 @@ impl<'a> ::flatbuffers::Verifiable for FieldUnion {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for FieldUnion {} impl ::flatbuffers::SimpleToVerifyInSlice for FieldUnion {}
pub struct FieldUnionUnionTableOffset {} pub struct FieldUnionUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -95,11 +107,13 @@ pub enum FieldUnionT {
NONE, NONE,
F(alloc::boxed::Box<FieldTableT>), F(alloc::boxed::Box<FieldTableT>),
} }
impl Default for FieldUnionT { impl Default for FieldUnionT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl FieldUnionT { impl FieldUnionT {
pub fn field_union_type(&self) -> FieldUnion { pub fn field_union_type(&self) -> FieldUnion {
match self { match self {
@@ -107,12 +121,14 @@ impl FieldUnionT {
Self::F(_) => FieldUnion::f, Self::F(_) => FieldUnion::f,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
Self::F(v) => Some(v.pack(fbb).as_union_value()), Self::F(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned FieldTableT, setting the union to NONE. /// If the union variant matches, return the owned FieldTableT, setting the union to NONE.
pub fn take_f(&mut self) -> Option<alloc::boxed::Box<FieldTableT>> { pub fn take_f(&mut self) -> Option<alloc::boxed::Box<FieldTableT>> {
if let Self::F(_) = self { if let Self::F(_) = self {
@@ -126,12 +142,15 @@ impl FieldUnionT {
None None
} }
} }
/// If the union variant matches, return a reference to the FieldTableT. /// If the union variant matches, return a reference to the FieldTableT.
pub fn as_f(&self) -> Option<&FieldTableT> { pub fn as_f(&self) -> Option<&FieldTableT> {
if let Self::F(v) = self { Some(v.as_ref()) } else { None } if let Self::F(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the FieldTableT. /// If the union variant matches, return a mutable reference to the FieldTableT.
pub fn as_f_mut(&mut self) -> Option<&mut FieldTableT> { pub fn as_f_mut(&mut self) -> Option<&mut FieldTableT> {
if let Self::F(v) = self { Some(v.as_mut()) } else { None } if let Self::F(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,10 +2,13 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_GAME_MESSAGE: u8 = 0; pub const ENUM_MIN_GAME_MESSAGE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_GAME_MESSAGE: u8 = 3; pub const ENUM_MAX_GAME_MESSAGE: u8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub const ENUM_VALUES_GAME_MESSAGE: [GameMessage; 4] = [ pub const ENUM_VALUES_GAME_MESSAGE: [GameMessage; 4] = [
@@ -18,6 +21,7 @@ pub const ENUM_VALUES_GAME_MESSAGE: [GameMessage; 4] = [
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
pub struct GameMessage(pub u8); pub struct GameMessage(pub u8);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
impl GameMessage { impl GameMessage {
pub const NONE: Self = Self(0); pub const NONE: Self = Self(0);
@@ -33,6 +37,7 @@ impl GameMessage {
Self::PlayerSpectate, Self::PlayerSpectate,
Self::PlayerInputChange, Self::PlayerInputChange,
]; ];
/// Returns the variant's name or "" if unknown. /// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> { pub fn variant_name(self) -> Option<&'static str> {
match self { match self {
@@ -44,6 +49,7 @@ impl GameMessage {
} }
} }
} }
impl ::core::fmt::Debug for GameMessage { impl ::core::fmt::Debug for GameMessage {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() { if let Some(name) = self.variant_name() {
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for GameMessage {
} }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for GameMessage { impl<'a> ::flatbuffers::Follow<'a> for GameMessage {
type Inner = Self; type Inner = Self;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) }; let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for GameMessage {
impl ::flatbuffers::Push for GameMessage { impl ::flatbuffers::Push for GameMessage {
type Output = GameMessage; type Output = GameMessage;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) }; unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for GameMessage {
impl ::flatbuffers::EndianScalar for GameMessage { impl ::flatbuffers::EndianScalar for GameMessage {
type Scalar = u8; type Scalar = u8;
#[inline] #[inline]
fn to_little_endian(self) -> u8 { fn to_little_endian(self) -> u8 {
self.0.to_le() self.0.to_le()
} }
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self { fn from_little_endian(v: u8) -> Self {
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for GameMessage {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for GameMessage {} impl ::flatbuffers::SimpleToVerifyInSlice for GameMessage {}
pub struct GameMessageUnionTableOffset {} pub struct GameMessageUnionTableOffset {}
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -105,11 +117,13 @@ pub enum GameMessageT {
PlayerSpectate(alloc::boxed::Box<PlayerSpectateT>), PlayerSpectate(alloc::boxed::Box<PlayerSpectateT>),
PlayerInputChange(alloc::boxed::Box<PlayerInputChangeT>), PlayerInputChange(alloc::boxed::Box<PlayerInputChangeT>),
} }
impl Default for GameMessageT { impl Default for GameMessageT {
fn default() -> Self { fn default() -> Self {
Self::NONE Self::NONE
} }
} }
impl GameMessageT { impl GameMessageT {
pub fn game_message_type(&self) -> GameMessage { pub fn game_message_type(&self) -> GameMessage {
match self { match self {
@@ -119,6 +133,7 @@ impl GameMessageT {
Self::PlayerInputChange(_) => GameMessage::PlayerInputChange, Self::PlayerInputChange(_) => GameMessage::PlayerInputChange,
} }
} }
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> { pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self { match self {
Self::NONE => None, Self::NONE => None,
@@ -127,6 +142,7 @@ impl GameMessageT {
Self::PlayerInputChange(v) => Some(v.pack(fbb).as_union_value()), Self::PlayerInputChange(v) => Some(v.pack(fbb).as_union_value()),
} }
} }
/// If the union variant matches, return the owned PlayerStatEventT, setting the union to NONE. /// If the union variant matches, return the owned PlayerStatEventT, setting the union to NONE.
pub fn take_player_stat_event(&mut self) -> Option<alloc::boxed::Box<PlayerStatEventT>> { pub fn take_player_stat_event(&mut self) -> Option<alloc::boxed::Box<PlayerStatEventT>> {
if let Self::PlayerStatEvent(_) = self { if let Self::PlayerStatEvent(_) = self {
@@ -140,14 +156,17 @@ impl GameMessageT {
None None
} }
} }
/// If the union variant matches, return a reference to the PlayerStatEventT. /// If the union variant matches, return a reference to the PlayerStatEventT.
pub fn as_player_stat_event(&self) -> Option<&PlayerStatEventT> { pub fn as_player_stat_event(&self) -> Option<&PlayerStatEventT> {
if let Self::PlayerStatEvent(v) = self { Some(v.as_ref()) } else { None } if let Self::PlayerStatEvent(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the PlayerStatEventT. /// If the union variant matches, return a mutable reference to the PlayerStatEventT.
pub fn as_player_stat_event_mut(&mut self) -> Option<&mut PlayerStatEventT> { pub fn as_player_stat_event_mut(&mut self) -> Option<&mut PlayerStatEventT> {
if let Self::PlayerStatEvent(v) = self { Some(v.as_mut()) } else { None } if let Self::PlayerStatEvent(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned PlayerSpectateT, setting the union to NONE. /// If the union variant matches, return the owned PlayerSpectateT, setting the union to NONE.
pub fn take_player_spectate(&mut self) -> Option<alloc::boxed::Box<PlayerSpectateT>> { pub fn take_player_spectate(&mut self) -> Option<alloc::boxed::Box<PlayerSpectateT>> {
if let Self::PlayerSpectate(_) = self { if let Self::PlayerSpectate(_) = self {
@@ -161,14 +180,17 @@ impl GameMessageT {
None None
} }
} }
/// If the union variant matches, return a reference to the PlayerSpectateT. /// If the union variant matches, return a reference to the PlayerSpectateT.
pub fn as_player_spectate(&self) -> Option<&PlayerSpectateT> { pub fn as_player_spectate(&self) -> Option<&PlayerSpectateT> {
if let Self::PlayerSpectate(v) = self { Some(v.as_ref()) } else { None } if let Self::PlayerSpectate(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the PlayerSpectateT. /// If the union variant matches, return a mutable reference to the PlayerSpectateT.
pub fn as_player_spectate_mut(&mut self) -> Option<&mut PlayerSpectateT> { pub fn as_player_spectate_mut(&mut self) -> Option<&mut PlayerSpectateT> {
if let Self::PlayerSpectate(v) = self { Some(v.as_mut()) } else { None } if let Self::PlayerSpectate(v) = self { Some(v.as_mut()) } else { None }
} }
/// If the union variant matches, return the owned PlayerInputChangeT, setting the union to NONE. /// If the union variant matches, return the owned PlayerInputChangeT, setting the union to NONE.
pub fn take_player_input_change(&mut self) -> Option<alloc::boxed::Box<PlayerInputChangeT>> { pub fn take_player_input_change(&mut self) -> Option<alloc::boxed::Box<PlayerInputChangeT>> {
if let Self::PlayerInputChange(_) = self { if let Self::PlayerInputChange(_) = self {
@@ -182,12 +204,15 @@ impl GameMessageT {
None None
} }
} }
/// If the union variant matches, return a reference to the PlayerInputChangeT. /// If the union variant matches, return a reference to the PlayerInputChangeT.
pub fn as_player_input_change(&self) -> Option<&PlayerInputChangeT> { pub fn as_player_input_change(&self) -> Option<&PlayerInputChangeT> {
if let Self::PlayerInputChange(v) = self { Some(v.as_ref()) } else { None } if let Self::PlayerInputChange(v) = self { Some(v.as_ref()) } else { None }
} }
/// If the union variant matches, return a mutable reference to the PlayerInputChangeT. /// If the union variant matches, return a mutable reference to the PlayerInputChangeT.
pub fn as_player_input_change_mut(&mut self) -> Option<&mut PlayerInputChangeT> { pub fn as_player_input_change_mut(&mut self) -> Option<&mut PlayerInputChangeT> {
if let Self::PlayerInputChange(v) = self { Some(v.as_mut()) } else { None } if let Self::PlayerInputChange(v) = self { Some(v.as_mut()) } else { None }
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum GameMessageWrapperOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum GameMessageWrapperOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct GameMessageWrapper<'a> { pub struct GameMessageWrapper<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for GameMessageWrapper<'a> { impl<'a> ::flatbuffers::Follow<'a> for GameMessageWrapper<'a> {
type Inner = GameMessageWrapper<'a>; type Inner = GameMessageWrapper<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +31,7 @@ impl<'a> GameMessageWrapper<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
GameMessageWrapper { _tab: table } GameMessageWrapper { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -72,6 +75,7 @@ impl<'a> GameMessageWrapper<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Some(GameMessage::NONE)).unwrap()} unsafe { self._tab.get::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Some(GameMessage::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn Message(&self) -> Option<::flatbuffers::Table<'a>> { pub fn Message(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -79,6 +83,7 @@ impl<'a> GameMessageWrapper<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(GameMessageWrapper::VT_MESSAGE, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(GameMessageWrapper::VT_MESSAGE, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn Message_as_player_stat_event(&self) -> Option<PlayerStatEvent<'a>> { pub fn Message_as_player_stat_event(&self) -> Option<PlayerStatEvent<'a>> {
@@ -123,7 +128,6 @@ impl<'a> GameMessageWrapper<'a> {
None None
} }
} }
} }
impl ::flatbuffers::Verifiable for GameMessageWrapper<'_> { impl ::flatbuffers::Verifiable for GameMessageWrapper<'_> {
@@ -144,10 +148,12 @@ impl ::flatbuffers::Verifiable for GameMessageWrapper<'_> {
Ok(()) Ok(())
} }
} }
pub struct GameMessageWrapperArgs { pub struct GameMessageWrapperArgs {
pub Message_type: GameMessage, pub Message_type: GameMessage,
pub Message: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>, pub Message: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
} }
impl<'a> Default for GameMessageWrapperArgs { impl<'a> Default for GameMessageWrapperArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -162,15 +168,18 @@ pub struct GameMessageWrapperBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + '
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_Message_type(&mut self, Message_type: GameMessage) { pub fn add_Message_type(&mut self, Message_type: GameMessage) {
self.fbb_.push_slot::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Message_type, GameMessage::NONE); self.fbb_.push_slot::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Message_type, GameMessage::NONE);
} }
#[inline] #[inline]
pub fn add_Message(&mut self, Message: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_Message(&mut self, Message: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(GameMessageWrapper::VT_MESSAGE, Message); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(GameMessageWrapper::VT_MESSAGE, Message);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameMessageWrapperBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameMessageWrapperBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -179,6 +188,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<GameMessageWrapper<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<GameMessageWrapper<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -220,11 +230,13 @@ impl ::core::fmt::Debug for GameMessageWrapper<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct GameMessageWrapperT { pub struct GameMessageWrapperT {
pub Message: GameMessageT, pub Message: GameMessageT,
} }
impl Default for GameMessageWrapperT { impl Default for GameMessageWrapperT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -232,6 +244,7 @@ impl Default for GameMessageWrapperT {
} }
} }
} }
impl GameMessageWrapperT { impl GameMessageWrapperT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum PlayerInputChangeOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum PlayerInputChangeOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct PlayerInputChange<'a> { pub struct PlayerInputChange<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for PlayerInputChange<'a> { impl<'a> ::flatbuffers::Follow<'a> for PlayerInputChange<'a> {
type Inner = PlayerInputChange<'a>; type Inner = PlayerInputChange<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for PlayerInputChange<'a> {
} }
impl<'a> PlayerInputChange<'a> { impl<'a> PlayerInputChange<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"RustNamerTest.PlayerInputChange" "RustNamerTest.PlayerInputChange"
} }
@@ -27,6 +28,7 @@ impl<'a> PlayerInputChange<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PlayerInputChange { _tab: table } PlayerInputChange { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for PlayerInputChange<'_> {
Ok(()) Ok(())
} }
} }
pub struct PlayerInputChangeArgs { pub struct PlayerInputChangeArgs {
} }
impl<'a> Default for PlayerInputChangeArgs { impl<'a> Default for PlayerInputChangeArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -66,6 +70,7 @@ pub struct PlayerInputChangeBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerInputChangeBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerInputChangeBuilder<'a, 'b, A> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerInputChange<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerInputChange<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for PlayerInputChange<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct PlayerInputChangeT { pub struct PlayerInputChangeT {
} }
impl Default for PlayerInputChangeT { impl Default for PlayerInputChangeT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl PlayerInputChangeT { impl PlayerInputChangeT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum PlayerSpectateOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum PlayerSpectateOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct PlayerSpectate<'a> { pub struct PlayerSpectate<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for PlayerSpectate<'a> { impl<'a> ::flatbuffers::Follow<'a> for PlayerSpectate<'a> {
type Inner = PlayerSpectate<'a>; type Inner = PlayerSpectate<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for PlayerSpectate<'a> {
} }
impl<'a> PlayerSpectate<'a> { impl<'a> PlayerSpectate<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"RustNamerTest.PlayerSpectate" "RustNamerTest.PlayerSpectate"
} }
@@ -27,6 +28,7 @@ impl<'a> PlayerSpectate<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PlayerSpectate { _tab: table } PlayerSpectate { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for PlayerSpectate<'_> {
Ok(()) Ok(())
} }
} }
pub struct PlayerSpectateArgs { pub struct PlayerSpectateArgs {
} }
impl<'a> Default for PlayerSpectateArgs { impl<'a> Default for PlayerSpectateArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -66,6 +70,7 @@ pub struct PlayerSpectateBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerSpectateBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerSpectateBuilder<'a, 'b, A> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b,
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerSpectate<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerSpectate<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for PlayerSpectate<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct PlayerSpectateT { pub struct PlayerSpectateT {
} }
impl Default for PlayerSpectateT { impl Default for PlayerSpectateT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl PlayerSpectateT { impl PlayerSpectateT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum PlayerStatEventOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum PlayerStatEventOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct PlayerStatEvent<'a> { pub struct PlayerStatEvent<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for PlayerStatEvent<'a> { impl<'a> ::flatbuffers::Follow<'a> for PlayerStatEvent<'a> {
type Inner = PlayerStatEvent<'a>; type Inner = PlayerStatEvent<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for PlayerStatEvent<'a> {
} }
impl<'a> PlayerStatEvent<'a> { impl<'a> PlayerStatEvent<'a> {
pub const fn get_fully_qualified_name() -> &'static str { pub const fn get_fully_qualified_name() -> &'static str {
"RustNamerTest.PlayerStatEvent" "RustNamerTest.PlayerStatEvent"
} }
@@ -27,6 +28,7 @@ impl<'a> PlayerStatEvent<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PlayerStatEvent { _tab: table } PlayerStatEvent { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for PlayerStatEvent<'_> {
Ok(()) Ok(())
} }
} }
pub struct PlayerStatEventArgs { pub struct PlayerStatEventArgs {
} }
impl<'a> Default for PlayerStatEventArgs { impl<'a> Default for PlayerStatEventArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -66,6 +70,7 @@ pub struct PlayerStatEventBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a>
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerStatEventBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> PlayerStatEventBuilder<'a, 'b, A> {
@@ -75,6 +80,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerStatEvent<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerStatEvent<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for PlayerStatEvent<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct PlayerStatEventT { pub struct PlayerStatEventT {
} }
impl Default for PlayerStatEventT { impl Default for PlayerStatEventT {
fn default() -> Self { fn default() -> Self {
Self { Self {
} }
} }
} }
impl PlayerStatEventT { impl PlayerStatEventT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,

View File

@@ -2,15 +2,18 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
// struct PossiblyReservedWords, aligned to 4 // struct PossiblyReservedWords, aligned to 4
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
pub struct PossiblyReservedWords(pub [u8; 16]); pub struct PossiblyReservedWords(pub [u8; 16]);
impl Default for PossiblyReservedWords { impl Default for PossiblyReservedWords {
fn default() -> Self { fn default() -> Self {
Self([0; 16]) Self([0; 16])
} }
} }
impl ::core::fmt::Debug for PossiblyReservedWords { impl ::core::fmt::Debug for PossiblyReservedWords {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("PossiblyReservedWords") f.debug_struct("PossiblyReservedWords")
@@ -23,27 +26,34 @@ impl ::core::fmt::Debug for PossiblyReservedWords {
} }
impl ::flatbuffers::SimpleToVerifyInSlice for PossiblyReservedWords {} impl ::flatbuffers::SimpleToVerifyInSlice for PossiblyReservedWords {}
impl<'a> ::flatbuffers::Follow<'a> for PossiblyReservedWords { impl<'a> ::flatbuffers::Follow<'a> for PossiblyReservedWords {
type Inner = &'a PossiblyReservedWords; type Inner = &'a PossiblyReservedWords;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a PossiblyReservedWords>::follow(buf, loc) } unsafe { <&'a PossiblyReservedWords>::follow(buf, loc) }
} }
} }
impl<'a> ::flatbuffers::Follow<'a> for &'a PossiblyReservedWords { impl<'a> ::flatbuffers::Follow<'a> for &'a PossiblyReservedWords {
type Inner = &'a PossiblyReservedWords; type Inner = &'a PossiblyReservedWords;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<PossiblyReservedWords>(buf, loc) } unsafe { ::flatbuffers::follow_cast_ref::<PossiblyReservedWords>(buf, loc) }
} }
} }
impl<'b> ::flatbuffers::Push for PossiblyReservedWords { impl<'b> ::flatbuffers::Push for PossiblyReservedWords {
type Output = PossiblyReservedWords; type Output = PossiblyReservedWords;
#[inline] #[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const PossiblyReservedWords as *const u8, <Self as ::flatbuffers::Push>::size()) }; let src = unsafe { ::core::slice::from_raw_parts(self as *const PossiblyReservedWords as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src); dst.copy_from_slice(src);
} }
#[inline] #[inline]
fn alignment() -> ::flatbuffers::PushAlignment { fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4) ::flatbuffers::PushAlignment::new(4)
@@ -212,6 +222,7 @@ pub struct PossiblyReservedWordsT {
pub size: f32, pub size: f32,
pub alignment: f32, pub alignment: f32,
} }
impl PossiblyReservedWordsT { impl PossiblyReservedWordsT {
pub fn pack(&self) -> PossiblyReservedWords { pub fn pack(&self) -> PossiblyReservedWords {
PossiblyReservedWords::new( PossiblyReservedWords::new(
@@ -222,4 +233,3 @@ impl PossiblyReservedWordsT {
) )
} }
} }

View File

@@ -2,15 +2,17 @@
// @generated // @generated
extern crate alloc; extern crate alloc;
use super::*; use super::*;
pub enum RootTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub enum RootTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct RootTable<'a> { pub struct RootTable<'a> {
pub _tab: ::flatbuffers::Table<'a>, pub _tab: ::flatbuffers::Table<'a>,
} }
impl<'a> ::flatbuffers::Follow<'a> for RootTable<'a> { impl<'a> ::flatbuffers::Follow<'a> for RootTable<'a> {
type Inner = RootTable<'a>; type Inner = RootTable<'a>;
#[inline] #[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } } Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
@@ -29,6 +31,7 @@ impl<'a> RootTable<'a> {
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
RootTable { _tab: table } RootTable { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
@@ -62,6 +65,7 @@ impl<'a> RootTable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<FieldUnion>(RootTable::VT_FIELD42_TYPE, Some(FieldUnion::NONE)).unwrap()} unsafe { self._tab.get::<FieldUnion>(RootTable::VT_FIELD42_TYPE, Some(FieldUnion::NONE)).unwrap()}
} }
#[inline] #[inline]
pub fn field42(&self) -> Option<::flatbuffers::Table<'a>> { pub fn field42(&self) -> Option<::flatbuffers::Table<'a>> {
// Safety: // Safety:
@@ -69,6 +73,7 @@ impl<'a> RootTable<'a> {
// which contains a valid value in this slot // which contains a valid value in this slot
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(RootTable::VT_FIELD42, None)} unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(RootTable::VT_FIELD42, None)}
} }
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn field42_as_f(&self) -> Option<FieldTable<'a>> { pub fn field42_as_f(&self) -> Option<FieldTable<'a>> {
@@ -83,7 +88,6 @@ impl<'a> RootTable<'a> {
None None
} }
} }
} }
impl ::flatbuffers::Verifiable for RootTable<'_> { impl ::flatbuffers::Verifiable for RootTable<'_> {
@@ -102,10 +106,12 @@ impl ::flatbuffers::Verifiable for RootTable<'_> {
Ok(()) Ok(())
} }
} }
pub struct RootTableArgs { pub struct RootTableArgs {
pub field42_type: FieldUnion, pub field42_type: FieldUnion,
pub field42: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>, pub field42: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
} }
impl<'a> Default for RootTableArgs { impl<'a> Default for RootTableArgs {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
@@ -120,15 +126,18 @@ pub struct RootTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> { impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> {
#[inline] #[inline]
pub fn add_field42_type(&mut self, field42_type: FieldUnion) { pub fn add_field42_type(&mut self, field42_type: FieldUnion) {
self.fbb_.push_slot::<FieldUnion>(RootTable::VT_FIELD42_TYPE, field42_type, FieldUnion::NONE); self.fbb_.push_slot::<FieldUnion>(RootTable::VT_FIELD42_TYPE, field42_type, FieldUnion::NONE);
} }
#[inline] #[inline]
pub fn add_field42(&mut self, field42: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) { pub fn add_field42(&mut self, field42: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(RootTable::VT_FIELD42, field42); self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(RootTable::VT_FIELD42, field42);
} }
#[inline] #[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> RootTableBuilder<'a, 'b, A> { pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> RootTableBuilder<'a, 'b, A> {
let start = _fbb.start_table(); let start = _fbb.start_table();
@@ -137,6 +146,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> {
start_: start, start_: start,
} }
} }
#[inline] #[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<RootTable<'a>> { pub fn finish(self) -> ::flatbuffers::WIPOffset<RootTable<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
@@ -164,11 +174,13 @@ impl ::core::fmt::Debug for RootTable<'_> {
ds.finish() ds.finish()
} }
} }
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct RootTableT { pub struct RootTableT {
pub field42: FieldUnionT, pub field42: FieldUnionT,
} }
impl Default for RootTableT { impl Default for RootTableT {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -176,6 +188,7 @@ impl Default for RootTableT {
} }
} }
} }
impl RootTableT { impl RootTableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>( pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self, &self,