Updates Rust codegen to use proper indentation (#8952)

* Fixes identation of generated Rust code

* Regenerates generated schemas
This commit is contained in:
Cameron Mulhern
2026-03-05 09:04:55 -05:00
committed by GitHub
parent 2b8e4d3af0
commit 57659d9f38
105 changed files with 16456 additions and 16412 deletions

View File

@@ -12,8 +12,8 @@ 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.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_AB: [AB; 2] = [
AB::A,
AB::B,
AB::A,
AB::B,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@@ -22,44 +22,44 @@ pub(crate) struct AB(pub i8);
#[allow(non_upper_case_globals)]
impl AB {
pub const A: Self = Self(0);
pub const B: Self = Self(1);
pub const A: Self = Self(0);
pub const B: Self = Self(1);
pub const ENUM_MIN: i8 = 0;
pub const ENUM_MAX: i8 = 1;
pub const ENUM_VALUES: &'static [Self] = &[
Self::A,
Self::B,
];
pub const ENUM_MIN: i8 = 0;
pub const ENUM_MAX: i8 = 1;
pub const ENUM_VALUES: &'static [Self] = &[
Self::A,
Self::B,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::A => Some("A"),
Self::B => Some("B"),
_ => None,
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::A => Some("A"),
Self::B => Some("B"),
_ => None,
}
}
}
}
impl ::core::fmt::Debug for AB {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for AB {
type Inner = Self;
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b)
}
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b)
}
}
impl ::flatbuffers::Push for AB {
@@ -72,28 +72,28 @@ impl ::flatbuffers::Push for AB {
}
impl ::flatbuffers::EndianScalar for AB {
type Scalar = i8;
type Scalar = i8;
#[inline]
fn to_little_endian(self) -> i8 {
self.0.to_le()
}
#[inline]
fn to_little_endian(self) -> i8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self {
let b = i8::from_le(v);
Self(b)
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self {
let b = i8::from_le(v);
Self(b)
}
}
impl<'a> ::flatbuffers::Verifiable for AB {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
i8::run_verifier(v, pos)
}
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
i8::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for AB {}

View File

@@ -7,66 +7,66 @@ pub(crate) enum AnnotationsOffset {}
#[derive(Copy, Clone, PartialEq)]
pub(crate) struct Annotations<'a> {
pub _tab: ::flatbuffers::Table<'a>,
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for Annotations<'a> {
type Inner = Annotations<'a>;
type Inner = Annotations<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Annotations<'a> {
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"Annotations"
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Annotations { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args AnnotationsArgs
) -> ::flatbuffers::WIPOffset<Annotations<'bldr>> {
let mut builder = AnnotationsBuilder::new(_fbb);
builder.add_value(args.value);
builder.finish()
}
pub fn unpack(&self) -> AnnotationsT {
let value = self.value();
AnnotationsT {
value,
pub const fn get_fully_qualified_name() -> &'static str {
"Annotations"
}
}
#[inline]
pub fn value(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Annotations::VT_VALUE, Some(0)).unwrap()}
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Annotations { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args AnnotationsArgs
) -> ::flatbuffers::WIPOffset<Annotations<'bldr>> {
let mut builder = AnnotationsBuilder::new(_fbb);
builder.add_value(args.value);
builder.finish()
}
pub fn unpack(&self) -> AnnotationsT {
let value = self.value();
AnnotationsT {
value,
}
}
#[inline]
pub fn value(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Annotations::VT_VALUE, Some(0)).unwrap()}
}
}
impl ::flatbuffers::Verifiable for Annotations<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish();
Ok(())
}
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish();
Ok(())
}
}
pub(crate) struct AnnotationsArgs {
@@ -74,71 +74,71 @@ pub(crate) struct AnnotationsArgs {
}
impl<'a> Default for AnnotationsArgs {
#[inline]
fn default() -> Self {
AnnotationsArgs {
value: 0,
#[inline]
fn default() -> Self {
AnnotationsArgs {
value: 0,
}
}
}
}
pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
#[inline]
pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> {
let start = _fbb.start_table();
AnnotationsBuilder {
fbb_: _fbb,
start_: start,
#[inline]
pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Annotations<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> {
let start = _fbb.start_table();
AnnotationsBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Annotations<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Annotations<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Annotations");
ds.field("value", &self.value());
ds.finish()
}
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Annotations");
ds.field("value", &self.value());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct AnnotationsT {
pub value: i32,
pub value: i32,
}
impl Default for AnnotationsT {
fn default() -> Self {
Self {
value: 0,
fn default() -> Self {
Self {
value: 0,
}
}
}
}
impl AnnotationsT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Annotations<'b>> {
let value = self.value;
Annotations::create(_fbb, &AnnotationsArgs{
value,
})
}
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Annotations<'b>> {
let value = self.value;
Annotations::create(_fbb, &AnnotationsArgs{
value,
})
}
}

View File

@@ -12,9 +12,9 @@ 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.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_ANY: [Any; 3] = [
Any::NONE,
Any::Game,
Any::Annotations,
Any::NONE,
Any::Game,
Any::Annotations,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@@ -23,47 +23,47 @@ pub(crate) struct Any(pub u8);
#[allow(non_upper_case_globals)]
impl Any {
pub const NONE: Self = Self(0);
pub const Game: Self = Self(1);
pub const Annotations: Self = Self(2);
pub const NONE: Self = Self(0);
pub const Game: Self = Self(1);
pub const Annotations: Self = Self(2);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 2;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::Game,
Self::Annotations,
];
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 2;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::Game,
Self::Annotations,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::Game => Some("Game"),
Self::Annotations => Some("Annotations"),
_ => None,
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::Game => Some("Game"),
Self::Annotations => Some("Annotations"),
_ => None,
}
}
}
}
impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for Any {
type Inner = Self;
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b)
}
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
Self(b)
}
}
impl ::flatbuffers::Push for Any {
@@ -76,28 +76,28 @@ impl ::flatbuffers::Push for Any {
}
impl ::flatbuffers::EndianScalar for Any {
type Scalar = u8;
type Scalar = u8;
#[inline]
fn to_little_endian(self) -> u8 {
self.0.to_le()
}
#[inline]
fn to_little_endian(self) -> u8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self {
let b = u8::from_le(v);
Self(b)
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self {
let b = u8::from_le(v);
Self(b)
}
}
impl<'a> ::flatbuffers::Verifiable for Any {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
@@ -108,80 +108,80 @@ pub(crate) struct AnyUnionTableOffset {}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub(crate) enum AnyT {
NONE,
Game(alloc::boxed::Box<GameT>),
Annotations(alloc::boxed::Box<AnnotationsT>),
NONE,
Game(alloc::boxed::Box<GameT>),
Annotations(alloc::boxed::Box<AnnotationsT>),
}
impl Default for AnyT {
fn default() -> Self {
Self::NONE
}
fn default() -> Self {
Self::NONE
}
}
impl AnyT {
pub fn any_type(&self) -> Any {
match self {
Self::NONE => Any::NONE,
Self::Game(_) => Any::Game,
Self::Annotations(_) => Any::Annotations,
pub fn any_type(&self) -> Any {
match self {
Self::NONE => Any::NONE,
Self::Game(_) => Any::Game,
Self::Annotations(_) => Any::Annotations,
}
}
}
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self {
Self::NONE => None,
Self::Game(v) => Some(v.pack(fbb).as_union_value()),
Self::Annotations(v) => Some(v.pack(fbb).as_union_value()),
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
match self {
Self::NONE => None,
Self::Game(v) => Some(v.pack(fbb).as_union_value()),
Self::Annotations(v) => Some(v.pack(fbb).as_union_value()),
}
}
}
/// 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>> {
if let Self::Game(_) = self {
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Game(w) = v {
Some(w)
} else {
unreachable!()
}
} else {
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>> {
if let Self::Game(_) = self {
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Game(w) = v {
Some(w)
} else {
unreachable!()
}
} else {
None
}
}
}
/// If the union variant matches, return a reference to the GameT.
pub fn as_game(&self) -> Option<&GameT> {
if let Self::Game(v) = self { Some(v.as_ref()) } else { None }
}
/// If the union variant matches, return a mutable reference to the GameT.
pub fn as_game_mut(&mut self) -> Option<&mut GameT> {
if let Self::Game(v) = self { Some(v.as_mut()) } else { None }
}
/// If the union variant matches, return the owned AnnotationsT, setting the union to NONE.
pub fn take_annotations(&mut self) -> Option<alloc::boxed::Box<AnnotationsT>> {
if let Self::Annotations(_) = self {
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Annotations(w) = v {
Some(w)
} else {
unreachable!()
}
} else {
None
/// If the union variant matches, return a reference to the GameT.
pub fn as_game(&self) -> Option<&GameT> {
if let Self::Game(v) = self { Some(v.as_ref()) } else { None }
}
}
/// If the union variant matches, return a reference to the AnnotationsT.
pub fn as_annotations(&self) -> Option<&AnnotationsT> {
if let Self::Annotations(v) = self { Some(v.as_ref()) } else { None }
}
/// If the union variant matches, return a mutable reference to the GameT.
pub fn as_game_mut(&mut self) -> Option<&mut GameT> {
if let Self::Game(v) = self { Some(v.as_mut()) } else { None }
}
/// If the union variant matches, return a mutable reference to the AnnotationsT.
pub fn as_annotations_mut(&mut self) -> Option<&mut AnnotationsT> {
if let Self::Annotations(v) = self { Some(v.as_mut()) } else { None }
}
/// If the union variant matches, return the owned AnnotationsT, setting the union to NONE.
pub fn take_annotations(&mut self) -> Option<alloc::boxed::Box<AnnotationsT>> {
if let Self::Annotations(_) = self {
let v = ::core::mem::replace(self, Self::NONE);
if let Self::Annotations(w) = v {
Some(w)
} else {
unreachable!()
}
} else {
None
}
}
/// If the union variant matches, return a reference to the AnnotationsT.
pub fn as_annotations(&self) -> Option<&AnnotationsT> {
if let Self::Annotations(v) = self { Some(v.as_ref()) } else { None }
}
/// If the union variant matches, return a mutable reference to the AnnotationsT.
pub fn as_annotations_mut(&mut self) -> Option<&mut AnnotationsT> {
if let Self::Annotations(v) = self { Some(v.as_mut()) } else { None }
}
}

View File

@@ -7,66 +7,66 @@ pub(crate) enum GameOffset {}
#[derive(Copy, Clone, PartialEq)]
pub(crate) struct Game<'a> {
pub _tab: ::flatbuffers::Table<'a>,
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for Game<'a> {
type Inner = Game<'a>;
type Inner = Game<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Game<'a> {
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
pub const fn get_fully_qualified_name() -> &'static str {
"Game"
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Game { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args GameArgs
) -> ::flatbuffers::WIPOffset<Game<'bldr>> {
let mut builder = GameBuilder::new(_fbb);
builder.add_value(args.value);
builder.finish()
}
pub fn unpack(&self) -> GameT {
let value = self.value();
GameT {
value,
pub const fn get_fully_qualified_name() -> &'static str {
"Game"
}
}
#[inline]
pub fn value(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Game::VT_VALUE, Some(0)).unwrap()}
}
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Game { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args GameArgs
) -> ::flatbuffers::WIPOffset<Game<'bldr>> {
let mut builder = GameBuilder::new(_fbb);
builder.add_value(args.value);
builder.finish()
}
pub fn unpack(&self) -> GameT {
let value = self.value();
GameT {
value,
}
}
#[inline]
pub fn value(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Game::VT_VALUE, Some(0)).unwrap()}
}
}
impl ::flatbuffers::Verifiable for Game<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish();
Ok(())
}
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<i32>("value", Self::VT_VALUE, false)?
.finish();
Ok(())
}
}
pub(crate) struct GameArgs {
@@ -74,71 +74,71 @@ pub(crate) struct GameArgs {
}
impl<'a> Default for GameArgs {
#[inline]
fn default() -> Self {
GameArgs {
value: 0,
#[inline]
fn default() -> Self {
GameArgs {
value: 0,
}
}
}
}
pub(crate) struct GameBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
#[inline]
pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
let start = _fbb.start_table();
GameBuilder {
fbb_: _fbb,
start_: start,
#[inline]
pub fn add_value(&mut self, value: i32) {
self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Game<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
let start = _fbb.start_table();
GameBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Game<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Game<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Game");
ds.field("value", &self.value());
ds.finish()
}
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Game");
ds.field("value", &self.value());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct GameT {
pub value: i32,
pub value: i32,
}
impl Default for GameT {
fn default() -> Self {
Self {
value: 0,
fn default() -> Self {
Self {
value: 0,
}
}
}
}
impl GameT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Game<'b>> {
let value = self.value;
Game::create(_fbb, &GameArgs{
value,
})
}
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<Game<'b>> {
let value = self.value;
Game::create(_fbb, &GameArgs{
value,
})
}
}

View File

@@ -8,38 +8,38 @@ use super::*;
#[derive(Clone, Copy, PartialEq)]
pub(crate) struct Object(pub [u8; 4]);
impl Default for Object {
fn default() -> Self {
Self([0; 4])
}
impl Default for Object {
fn default() -> Self {
Self([0; 4])
}
}
impl ::core::fmt::Debug for Object {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Object")
.field("value", &self.value())
.finish()
}
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Object")
.field("value", &self.value())
.finish()
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for Object {}
impl<'a> ::flatbuffers::Follow<'a> for Object {
type Inner = &'a Object;
type Inner = &'a Object;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Object>::follow(buf, loc) }
}
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Object>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a Object {
type Inner = &'a Object;
type Inner = &'a Object;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Object>(buf, loc) }
}
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Object>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for Object {
@@ -58,73 +58,73 @@ impl<'b> ::flatbuffers::Push for Object {
}
impl<'a> ::flatbuffers::Verifiable for Object {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
impl<'a> Object {
#[allow(clippy::too_many_arguments)]
pub fn new(
value: i32,
) -> Self {
let mut s = Self([0; 4]);
s.set_value(value);
s
}
pub const fn get_fully_qualified_name() -> &'static str {
"Object"
}
pub fn value(&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_value(&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>(),
);
#[allow(clippy::too_many_arguments)]
pub fn new(
value: i32,
) -> Self {
let mut s = Self([0; 4]);
s.set_value(value);
s
}
}
pub fn unpack(&self) -> ObjectT {
ObjectT {
value: self.value(),
pub const fn get_fully_qualified_name() -> &'static str {
"Object"
}
pub fn value(&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_value(&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) -> ObjectT {
ObjectT {
value: self.value(),
}
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub(crate) struct ObjectT {
pub value: i32,
pub value: i32,
}
impl ObjectT {
pub fn pack(&self) -> Object {
Object::new(
self.value,
)
}
pub fn pack(&self) -> Object {
Object::new(
self.value,
)
}
}