mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 23:40:57 +00:00
Fixes unused imports in Rust code generator (#8828)
* Fixes unused imports in Rust code generator * Regenerates generated schemas
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_AB: i8 = 0;
|
||||
@@ -43,8 +36,8 @@ impl AB {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for AB {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
impl ::core::fmt::Debug for AB {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
@@ -52,24 +45,24 @@ impl core::fmt::Debug for AB {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for AB {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for AB {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) };
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for AB {
|
||||
impl ::flatbuffers::Push for AB {
|
||||
type Output = AB;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); }
|
||||
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for AB {
|
||||
impl ::flatbuffers::EndianScalar for AB {
|
||||
type Scalar = i8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i8 {
|
||||
@@ -83,14 +76,13 @@ impl flatbuffers::EndianScalar for AB {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for AB {
|
||||
impl<'a> ::flatbuffers::Verifiable for AB {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
i8::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for AB {}
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for AB {}
|
||||
|
||||
@@ -1,45 +1,38 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub(crate) enum AnnotationsOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub(crate) struct Annotations<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Annotations<'a> {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Annotations<'a> {
|
||||
type Inner = Annotations<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Annotations<'a> {
|
||||
pub const VT_VALUE: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"Annotations"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
Annotations { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args AnnotationsArgs
|
||||
) -> flatbuffers::WIPOffset<Annotations<'bldr>> {
|
||||
) -> ::flatbuffers::WIPOffset<Annotations<'bldr>> {
|
||||
let mut builder = AnnotationsBuilder::new(_fbb);
|
||||
builder.add_value(args.value);
|
||||
builder.finish()
|
||||
@@ -61,12 +54,11 @@ impl<'a> Annotations<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for Annotations<'_> {
|
||||
impl ::flatbuffers::Verifiable for Annotations<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<i32>("value", Self::VT_VALUE, false)?
|
||||
.finish();
|
||||
@@ -85,17 +77,17 @@ impl<'a> Default for AnnotationsArgs {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
pub(crate) struct AnnotationsBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_value(&mut self, value: i32) {
|
||||
self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> {
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> AnnotationsBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
AnnotationsBuilder {
|
||||
fbb_: _fbb,
|
||||
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AnnotationsBuilder<'a, 'b, A> {
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<Annotations<'a>> {
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<Annotations<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Annotations<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
impl ::core::fmt::Debug for Annotations<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Annotations");
|
||||
ds.field("value", &self.value());
|
||||
ds.finish()
|
||||
@@ -129,10 +121,10 @@ impl Default for AnnotationsT {
|
||||
}
|
||||
}
|
||||
impl AnnotationsT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<Annotations<'b>> {
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<Annotations<'b>> {
|
||||
let value = self.value;
|
||||
Annotations::create(_fbb, &AnnotationsArgs{
|
||||
value,
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_ANY: u8 = 0;
|
||||
@@ -47,8 +40,8 @@ impl Any {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Any {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
impl ::core::fmt::Debug for Any {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
@@ -56,24 +49,24 @@ impl core::fmt::Debug for Any {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for Any {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Any {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for Any {
|
||||
impl ::flatbuffers::Push for Any {
|
||||
type Output = Any;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
|
||||
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for Any {
|
||||
impl ::flatbuffers::EndianScalar for Any {
|
||||
type Scalar = u8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
@@ -87,17 +80,16 @@ impl flatbuffers::EndianScalar for Any {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Any {
|
||||
impl<'a> ::flatbuffers::Verifiable for Any {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
u8::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Any {}
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for Any {}
|
||||
pub(crate) struct AnyUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -105,8 +97,8 @@ pub(crate) struct AnyUnionTableOffset {}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub(crate) enum AnyT {
|
||||
NONE,
|
||||
Game(Box<GameT>),
|
||||
Annotations(Box<AnnotationsT>),
|
||||
Game(alloc::boxed::Box<GameT>),
|
||||
Annotations(alloc::boxed::Box<AnnotationsT>),
|
||||
}
|
||||
impl Default for AnyT {
|
||||
fn default() -> Self {
|
||||
@@ -121,7 +113,7 @@ impl AnyT {
|
||||
Self::Annotations(_) => Any::Annotations,
|
||||
}
|
||||
}
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
|
||||
match self {
|
||||
Self::NONE => None,
|
||||
Self::Game(v) => Some(v.pack(fbb).as_union_value()),
|
||||
@@ -129,9 +121,9 @@ impl AnyT {
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return the owned GameT, setting the union to NONE.
|
||||
pub fn take_game(&mut self) -> Option<Box<GameT>> {
|
||||
pub fn take_game(&mut self) -> Option<alloc::boxed::Box<GameT>> {
|
||||
if let Self::Game(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
let v = ::core::mem::replace(self, Self::NONE);
|
||||
if let Self::Game(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
@@ -150,9 +142,9 @@ impl AnyT {
|
||||
if let Self::Game(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned AnnotationsT, setting the union to NONE.
|
||||
pub fn take_annotations(&mut self) -> Option<Box<AnnotationsT>> {
|
||||
pub fn take_annotations(&mut self) -> Option<alloc::boxed::Box<AnnotationsT>> {
|
||||
if let Self::Annotations(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
let v = ::core::mem::replace(self, Self::NONE);
|
||||
if let Self::Annotations(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
|
||||
@@ -1,45 +1,38 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub(crate) enum GameOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub(crate) struct Game<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Game<'a> {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Game<'a> {
|
||||
type Inner = Game<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Game<'a> {
|
||||
pub const VT_VALUE: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_VALUE: ::flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"Game"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
Game { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args GameArgs
|
||||
) -> flatbuffers::WIPOffset<Game<'bldr>> {
|
||||
) -> ::flatbuffers::WIPOffset<Game<'bldr>> {
|
||||
let mut builder = GameBuilder::new(_fbb);
|
||||
builder.add_value(args.value);
|
||||
builder.finish()
|
||||
@@ -61,12 +54,11 @@ impl<'a> Game<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for Game<'_> {
|
||||
impl ::flatbuffers::Verifiable for Game<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<i32>("value", Self::VT_VALUE, false)?
|
||||
.finish();
|
||||
@@ -85,17 +77,17 @@ impl<'a> Default for GameArgs {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct GameBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
pub(crate) struct GameBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_value(&mut self, value: i32) {
|
||||
self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> GameBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
GameBuilder {
|
||||
fbb_: _fbb,
|
||||
@@ -103,14 +95,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GameBuilder<'a, 'b, A> {
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<Game<'a>> {
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<Game<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Game<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
impl ::core::fmt::Debug for Game<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Game");
|
||||
ds.field("value", &self.value());
|
||||
ds.finish()
|
||||
@@ -129,10 +121,10 @@ impl Default for GameT {
|
||||
}
|
||||
}
|
||||
impl GameT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<Game<'b>> {
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<Game<'b>> {
|
||||
let value = self.value;
|
||||
Game::create(_fbb, &GameArgs{
|
||||
value,
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
// struct Object, aligned to 4
|
||||
#[repr(transparent)]
|
||||
@@ -18,48 +11,47 @@ impl Default for Object {
|
||||
Self([0; 4])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for Object {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
impl ::core::fmt::Debug for Object {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
f.debug_struct("Object")
|
||||
.field("value", &self.value())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for Object {}
|
||||
impl<'a> flatbuffers::Follow<'a> for Object {
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for Object {}
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Object {
|
||||
type Inner = &'a Object;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { <&'a Object>::follow(buf, loc) }
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a Object {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for &'a Object {
|
||||
type Inner = &'a Object;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { flatbuffers::follow_cast_ref::<Object>(buf, loc) }
|
||||
unsafe { ::flatbuffers::follow_cast_ref::<Object>(buf, loc) }
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for Object {
|
||||
impl<'b> ::flatbuffers::Push for Object {
|
||||
type Output = Object;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = unsafe { ::core::slice::from_raw_parts(self as *const Object as *const u8, <Self as flatbuffers::Push>::size()) };
|
||||
let src = unsafe { ::core::slice::from_raw_parts(self as *const Object as *const u8, <Self as ::flatbuffers::Push>::size()) };
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
#[inline]
|
||||
fn alignment() -> flatbuffers::PushAlignment {
|
||||
flatbuffers::PushAlignment::new(4)
|
||||
fn alignment() -> ::flatbuffers::PushAlignment {
|
||||
::flatbuffers::PushAlignment::new(4)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for Object {
|
||||
impl<'a> ::flatbuffers::Verifiable for Object {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
@@ -79,30 +71,30 @@ impl<'a> Object {
|
||||
}
|
||||
|
||||
pub fn value(&self) -> i32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
|
||||
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
::flatbuffers::EndianScalar::from_little_endian(unsafe {
|
||||
::core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_value(&mut self, x: i32) {
|
||||
let x_le = x.to_little_endian();
|
||||
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
::core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user