mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 16:58:07 +00:00
Generate better formatted Rust code (#8919)
* Cleans up Rust formatting * Regenerates generated schemas
This commit is contained in:
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum FieldTableOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum FieldTableOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct FieldTable<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for FieldTable<'a> {
|
||||
type Inner = FieldTable<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for FieldTable<'a> {
|
||||
}
|
||||
|
||||
impl<'a> FieldTable<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"RustNamerTest.FieldTable"
|
||||
}
|
||||
@@ -27,6 +28,7 @@ impl<'a> FieldTable<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
FieldTable { _tab: table }
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for FieldTable<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FieldTableArgs {
|
||||
}
|
||||
|
||||
impl<'a> Default for FieldTableArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -66,6 +70,7 @@ pub struct FieldTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> FieldTableBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<FieldTable<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for FieldTable<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct FieldTableT {
|
||||
}
|
||||
|
||||
impl Default for FieldTableT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FieldTableT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_FIELD_UNION: u8 = 0;
|
||||
|
||||
#[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;
|
||||
|
||||
#[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_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)]
|
||||
#[repr(transparent)]
|
||||
pub struct FieldUnion(pub u8);
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl FieldUnion {
|
||||
pub const NONE: Self = Self(0);
|
||||
@@ -27,6 +31,7 @@ impl FieldUnion {
|
||||
Self::NONE,
|
||||
Self::f,
|
||||
];
|
||||
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
@@ -36,6 +41,7 @@ impl FieldUnion {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for FieldUnion {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
@@ -45,8 +51,10 @@ impl ::core::fmt::Debug for FieldUnion {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for FieldUnion {
|
||||
type Inner = Self;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
@@ -56,6 +64,7 @@ impl<'a> ::flatbuffers::Follow<'a> for FieldUnion {
|
||||
|
||||
impl ::flatbuffers::Push for FieldUnion {
|
||||
type Output = FieldUnion;
|
||||
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
|
||||
@@ -64,10 +73,12 @@ impl ::flatbuffers::Push for FieldUnion {
|
||||
|
||||
impl ::flatbuffers::EndianScalar for FieldUnion {
|
||||
type Scalar = u8;
|
||||
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
self.0.to_le()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: u8) -> Self {
|
||||
@@ -86,6 +97,7 @@ impl<'a> ::flatbuffers::Verifiable for FieldUnion {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for FieldUnion {}
|
||||
|
||||
pub struct FieldUnionUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -95,11 +107,13 @@ pub enum FieldUnionT {
|
||||
NONE,
|
||||
F(alloc::boxed::Box<FieldTableT>),
|
||||
}
|
||||
|
||||
impl Default for FieldUnionT {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
|
||||
impl FieldUnionT {
|
||||
pub fn field_union_type(&self) -> FieldUnion {
|
||||
match self {
|
||||
@@ -107,12 +121,14 @@ impl FieldUnionT {
|
||||
Self::F(_) => FieldUnion::f,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
|
||||
match self {
|
||||
Self::NONE => None,
|
||||
Self::F(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return the owned FieldTableT, setting the union to NONE.
|
||||
pub fn take_f(&mut self) -> Option<alloc::boxed::Box<FieldTableT>> {
|
||||
if let Self::F(_) = self {
|
||||
@@ -126,12 +142,15 @@ impl FieldUnionT {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a reference to the FieldTableT.
|
||||
pub fn as_f(&self) -> Option<&FieldTableT> {
|
||||
if let Self::F(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a mutable reference to the FieldTableT.
|
||||
pub fn as_f_mut(&mut self) -> Option<&mut FieldTableT> {
|
||||
if let Self::F(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_GAME_MESSAGE: u8 = 0;
|
||||
|
||||
#[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;
|
||||
|
||||
#[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_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)]
|
||||
#[repr(transparent)]
|
||||
pub struct GameMessage(pub u8);
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl GameMessage {
|
||||
pub const NONE: Self = Self(0);
|
||||
@@ -33,6 +37,7 @@ impl GameMessage {
|
||||
Self::PlayerSpectate,
|
||||
Self::PlayerInputChange,
|
||||
];
|
||||
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
@@ -44,6 +49,7 @@ impl GameMessage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for GameMessage {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
@@ -53,8 +59,10 @@ impl ::core::fmt::Debug for GameMessage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for GameMessage {
|
||||
type Inner = Self;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
@@ -64,6 +72,7 @@ impl<'a> ::flatbuffers::Follow<'a> for GameMessage {
|
||||
|
||||
impl ::flatbuffers::Push for GameMessage {
|
||||
type Output = GameMessage;
|
||||
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
|
||||
@@ -72,10 +81,12 @@ impl ::flatbuffers::Push for GameMessage {
|
||||
|
||||
impl ::flatbuffers::EndianScalar for GameMessage {
|
||||
type Scalar = u8;
|
||||
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
self.0.to_le()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: u8) -> Self {
|
||||
@@ -94,6 +105,7 @@ impl<'a> ::flatbuffers::Verifiable for GameMessage {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for GameMessage {}
|
||||
|
||||
pub struct GameMessageUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -105,11 +117,13 @@ pub enum GameMessageT {
|
||||
PlayerSpectate(alloc::boxed::Box<PlayerSpectateT>),
|
||||
PlayerInputChange(alloc::boxed::Box<PlayerInputChangeT>),
|
||||
}
|
||||
|
||||
impl Default for GameMessageT {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
|
||||
impl GameMessageT {
|
||||
pub fn game_message_type(&self) -> GameMessage {
|
||||
match self {
|
||||
@@ -119,6 +133,7 @@ impl GameMessageT {
|
||||
Self::PlayerInputChange(_) => GameMessage::PlayerInputChange,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
|
||||
match self {
|
||||
Self::NONE => None,
|
||||
@@ -127,6 +142,7 @@ impl GameMessageT {
|
||||
Self::PlayerInputChange(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
|
||||
/// 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>> {
|
||||
if let Self::PlayerStatEvent(_) = self {
|
||||
@@ -140,14 +156,17 @@ impl GameMessageT {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a reference to the PlayerStatEventT.
|
||||
pub fn as_player_stat_event(&self) -> Option<&PlayerStatEventT> {
|
||||
if let Self::PlayerStatEvent(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a mutable reference to the 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 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>> {
|
||||
if let Self::PlayerSpectate(_) = self {
|
||||
@@ -161,14 +180,17 @@ impl GameMessageT {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a reference to the PlayerSpectateT.
|
||||
pub fn as_player_spectate(&self) -> Option<&PlayerSpectateT> {
|
||||
if let Self::PlayerSpectate(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a mutable reference to the 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 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>> {
|
||||
if let Self::PlayerInputChange(_) = self {
|
||||
@@ -182,12 +204,15 @@ impl GameMessageT {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a reference to the PlayerInputChangeT.
|
||||
pub fn as_player_input_change(&self) -> Option<&PlayerInputChangeT> {
|
||||
if let Self::PlayerInputChange(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a mutable reference to the 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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum GameMessageWrapperOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum GameMessageWrapperOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct GameMessageWrapper<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for GameMessageWrapper<'a> {
|
||||
type Inner = GameMessageWrapper<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -29,6 +31,7 @@ impl<'a> GameMessageWrapper<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
GameMessageWrapper { _tab: table }
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
@@ -72,6 +75,7 @@ impl<'a> GameMessageWrapper<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Some(GameMessage::NONE)).unwrap()}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn Message(&self) -> Option<::flatbuffers::Table<'a>> {
|
||||
// Safety:
|
||||
@@ -79,6 +83,7 @@ impl<'a> GameMessageWrapper<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(GameMessageWrapper::VT_MESSAGE, None)}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Message_as_player_stat_event(&self) -> Option<PlayerStatEvent<'a>> {
|
||||
@@ -123,7 +128,6 @@ impl<'a> GameMessageWrapper<'a> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for GameMessageWrapper<'_> {
|
||||
@@ -144,10 +148,12 @@ impl ::flatbuffers::Verifiable for GameMessageWrapper<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct GameMessageWrapperArgs {
|
||||
pub Message_type: GameMessage,
|
||||
pub Message: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
|
||||
}
|
||||
|
||||
impl<'a> Default for GameMessageWrapperArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -162,15 +168,18 @@ pub struct GameMessageWrapperBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + '
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_Message_type(&mut self, Message_type: GameMessage) {
|
||||
self.fbb_.push_slot::<GameMessage>(GameMessageWrapper::VT_MESSAGE_TYPE, Message_type, GameMessage::NONE);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_Message(&mut self, Message: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(GameMessageWrapper::VT_MESSAGE, Message);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameMessageWrapperBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
@@ -179,6 +188,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameMessageWrapperBuilder<'a,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<GameMessageWrapper<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -220,11 +230,13 @@ impl ::core::fmt::Debug for GameMessageWrapper<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct GameMessageWrapperT {
|
||||
pub Message: GameMessageT,
|
||||
}
|
||||
|
||||
impl Default for GameMessageWrapperT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -232,6 +244,7 @@ impl Default for GameMessageWrapperT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GameMessageWrapperT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum PlayerInputChangeOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum PlayerInputChangeOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct PlayerInputChange<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for PlayerInputChange<'a> {
|
||||
type Inner = PlayerInputChange<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for PlayerInputChange<'a> {
|
||||
}
|
||||
|
||||
impl<'a> PlayerInputChange<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"RustNamerTest.PlayerInputChange"
|
||||
}
|
||||
@@ -27,6 +28,7 @@ impl<'a> PlayerInputChange<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
PlayerInputChange { _tab: table }
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for PlayerInputChange<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerInputChangeArgs {
|
||||
}
|
||||
|
||||
impl<'a> Default for PlayerInputChangeArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -66,6 +70,7 @@ pub struct PlayerInputChangeBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerInputChangeBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerInputChange<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for PlayerInputChange<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PlayerInputChangeT {
|
||||
}
|
||||
|
||||
impl Default for PlayerInputChangeT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayerInputChangeT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum PlayerSpectateOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum PlayerSpectateOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct PlayerSpectate<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for PlayerSpectate<'a> {
|
||||
type Inner = PlayerSpectate<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for PlayerSpectate<'a> {
|
||||
}
|
||||
|
||||
impl<'a> PlayerSpectate<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"RustNamerTest.PlayerSpectate"
|
||||
}
|
||||
@@ -27,6 +28,7 @@ impl<'a> PlayerSpectate<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
PlayerSpectate { _tab: table }
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for PlayerSpectate<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerSpectateArgs {
|
||||
}
|
||||
|
||||
impl<'a> Default for PlayerSpectateArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -66,6 +70,7 @@ pub struct PlayerSpectateBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerSpectateBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerSpectate<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for PlayerSpectate<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PlayerSpectateT {
|
||||
}
|
||||
|
||||
impl Default for PlayerSpectateT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayerSpectateT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum PlayerStatEventOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum PlayerStatEventOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct PlayerStatEvent<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for PlayerStatEvent<'a> {
|
||||
type Inner = PlayerStatEvent<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -18,7 +20,6 @@ impl<'a> ::flatbuffers::Follow<'a> for PlayerStatEvent<'a> {
|
||||
}
|
||||
|
||||
impl<'a> PlayerStatEvent<'a> {
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"RustNamerTest.PlayerStatEvent"
|
||||
}
|
||||
@@ -27,6 +28,7 @@ impl<'a> PlayerStatEvent<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
PlayerStatEvent { _tab: table }
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
@@ -52,8 +54,10 @@ impl ::flatbuffers::Verifiable for PlayerStatEvent<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerStatEventArgs {
|
||||
}
|
||||
|
||||
impl<'a> Default for PlayerStatEventArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -66,6 +70,7 @@ pub struct PlayerStatEventBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a>
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> PlayerStatEventBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<PlayerStatEvent<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -88,16 +94,19 @@ impl ::core::fmt::Debug for PlayerStatEvent<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PlayerStatEventT {
|
||||
}
|
||||
|
||||
impl Default for PlayerStatEventT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayerStatEventT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
|
||||
// struct PossiblyReservedWords, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct PossiblyReservedWords(pub [u8; 16]);
|
||||
|
||||
impl Default for PossiblyReservedWords {
|
||||
fn default() -> Self {
|
||||
Self([0; 16])
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for PossiblyReservedWords {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
f.debug_struct("PossiblyReservedWords")
|
||||
@@ -23,27 +26,34 @@ impl ::core::fmt::Debug for PossiblyReservedWords {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for PossiblyReservedWords {}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for PossiblyReservedWords {
|
||||
type Inner = &'a PossiblyReservedWords;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { <&'a PossiblyReservedWords>::follow(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for &'a PossiblyReservedWords {
|
||||
type Inner = &'a PossiblyReservedWords;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { ::flatbuffers::follow_cast_ref::<PossiblyReservedWords>(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> ::flatbuffers::Push for PossiblyReservedWords {
|
||||
type Output = PossiblyReservedWords;
|
||||
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = unsafe { ::core::slice::from_raw_parts(self as *const PossiblyReservedWords as *const u8, <Self as ::flatbuffers::Push>::size()) };
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn alignment() -> ::flatbuffers::PushAlignment {
|
||||
::flatbuffers::PushAlignment::new(4)
|
||||
@@ -212,6 +222,7 @@ pub struct PossiblyReservedWordsT {
|
||||
pub size: f32,
|
||||
pub alignment: f32,
|
||||
}
|
||||
|
||||
impl PossiblyReservedWordsT {
|
||||
pub fn pack(&self) -> PossiblyReservedWords {
|
||||
PossiblyReservedWords::new(
|
||||
@@ -222,4 +233,3 @@ impl PossiblyReservedWordsT {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum RootTableOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum RootTableOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct RootTable<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for RootTable<'a> {
|
||||
type Inner = RootTable<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -29,6 +31,7 @@ impl<'a> RootTable<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
RootTable { _tab: table }
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
@@ -62,6 +65,7 @@ impl<'a> RootTable<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<FieldUnion>(RootTable::VT_FIELD42_TYPE, Some(FieldUnion::NONE)).unwrap()}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn field42(&self) -> Option<::flatbuffers::Table<'a>> {
|
||||
// Safety:
|
||||
@@ -69,6 +73,7 @@ impl<'a> RootTable<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(RootTable::VT_FIELD42, None)}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn field42_as_f(&self) -> Option<FieldTable<'a>> {
|
||||
@@ -83,7 +88,6 @@ impl<'a> RootTable<'a> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for RootTable<'_> {
|
||||
@@ -102,10 +106,12 @@ impl ::flatbuffers::Verifiable for RootTable<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RootTableArgs {
|
||||
pub field42_type: FieldUnion,
|
||||
pub field42: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
|
||||
}
|
||||
|
||||
impl<'a> Default for RootTableArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -120,15 +126,18 @@ pub struct RootTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_field42_type(&mut self, field42_type: FieldUnion) {
|
||||
self.fbb_.push_slot::<FieldUnion>(RootTable::VT_FIELD42_TYPE, field42_type, FieldUnion::NONE);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_field42(&mut self, field42: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(RootTable::VT_FIELD42, field42);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> RootTableBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
@@ -137,6 +146,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RootTableBuilder<'a, 'b, A> {
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<RootTable<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -164,11 +174,13 @@ impl ::core::fmt::Debug for RootTable<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct RootTableT {
|
||||
pub field42: FieldUnionT,
|
||||
}
|
||||
|
||||
impl Default for RootTableT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -176,6 +188,7 @@ impl Default for RootTableT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RootTableT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user