Make flatc generate Rust files not requiring std (#7273)

* Set an explicit 2018 edition for Rust tests

* Replace all `std` usage with `core` and `alloc` in Rust code generator

* Update the generated files

* Make Rust tests actually use no_std when the corresponding feature is enabled
This commit is contained in:
Bogdan Opanchuk
2022-04-26 18:40:03 -07:00
committed by GitHub
parent 9917a168cd
commit 750dde7669
88 changed files with 799 additions and 430 deletions

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Ability, aligned to 4
@@ -13,8 +17,8 @@ impl Default for Ability {
Self([0; 8])
}
}
impl std::fmt::Debug for Ability {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for Ability {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ability")
.field("id", &self.id())
.field("distance", &self.distance())
@@ -43,7 +47,7 @@ impl<'b> flatbuffers::Push for Ability {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
::core::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -54,7 +58,7 @@ impl<'b> flatbuffers::Push for &'b Ability {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
::core::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -115,7 +119,7 @@ impl<'a> Ability {
}
#[inline]
pub fn key_compare_with_value(&self, val: u32) -> ::std::cmp::Ordering {
pub fn key_compare_with_value(&self, val: u32) -> ::core::cmp::Ordering {
let key = self.id();
key.cmp(&val)
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
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.")]
@@ -46,8 +50,8 @@ impl AnyAmbiguousAliases {
}
}
}
impl std::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for AnyAmbiguousAliases {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -135,7 +139,7 @@ impl AnyAmbiguousAliasesT {
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<Box<MonsterT>> {
if let Self::M1(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::M1(w) = v {
Some(w)
} else {
@@ -156,7 +160,7 @@ impl AnyAmbiguousAliasesT {
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<MonsterT>> {
if let Self::M2(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v {
Some(w)
} else {
@@ -177,7 +181,7 @@ impl AnyAmbiguousAliasesT {
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<Box<MonsterT>> {
if let Self::M3(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::M3(w) = v {
Some(w)
} else {

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
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.")]
@@ -46,8 +50,8 @@ impl Any {
}
}
}
impl std::fmt::Debug for Any {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::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 {
@@ -135,7 +139,7 @@ impl AnyT {
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<Box<MonsterT>> {
if let Self::Monster(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::Monster(w) = v {
Some(w)
} else {
@@ -156,7 +160,7 @@ impl AnyT {
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::TestSimpleTableWithEnum(w) = v {
Some(w)
} else {
@@ -177,7 +181,7 @@ impl AnyT {
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::MyGameExample2Monster(w) = v {
Some(w)
} else {

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
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.")]
@@ -46,8 +50,8 @@ impl AnyUniqueAliases {
}
}
}
impl std::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for AnyUniqueAliases {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -135,7 +139,7 @@ impl AnyUniqueAliasesT {
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<Box<MonsterT>> {
if let Self::M(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::M(w) = v {
Some(w)
} else {
@@ -156,7 +160,7 @@ impl AnyUniqueAliasesT {
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::TS(w) = v {
Some(w)
} else {
@@ -177,7 +181,7 @@ impl AnyUniqueAliasesT {
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self {
let v = std::mem::replace(self, Self::NONE);
let v = core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v {
Some(w)
} else {

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum MonsterOffset {}
@@ -379,7 +383,7 @@ impl<'a> Monster<'a> {
}
#[inline]
pub fn key_compare_with_value(&self, val: & str) -> ::std::cmp::Ordering {
pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering {
let key = self.name();
key.cmp(val)
}
@@ -1116,8 +1120,8 @@ impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Monster");
ds.field("pos", &self.pos());
ds.field("mana", &self.mana());

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
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.")]
@@ -46,8 +50,8 @@ impl Race {
}
}
}
impl std::fmt::Debug for Race {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for Race {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ReferrableOffset {}
@@ -57,7 +61,7 @@ impl<'a> Referrable<'a> {
}
#[inline]
pub fn key_compare_with_value(&self, val: u64) -> ::std::cmp::Ordering {
pub fn key_compare_with_value(&self, val: u64) -> ::core::cmp::Ordering {
let key = self.id();
key.cmp(&val)
}
@@ -111,8 +115,8 @@ impl<'a: 'b, 'b> ReferrableBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for Referrable<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id());
ds.finish()

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum StatOffset {}
@@ -75,7 +79,7 @@ impl<'a> Stat<'a> {
}
#[inline]
pub fn key_compare_with_value(&self, val: u16) -> ::std::cmp::Ordering {
pub fn key_compare_with_value(&self, val: u16) -> ::core::cmp::Ordering {
let key = self.count();
key.cmp(&val)
}
@@ -143,8 +147,8 @@ impl<'a: 'b, 'b> StatBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for Stat<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for Stat<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Stat");
ds.field("id", &self.id());
ds.field("val", &self.val());

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct StructOfStructs, aligned to 4
@@ -13,8 +17,8 @@ impl Default for StructOfStructs {
Self([0; 20])
}
}
impl std::fmt::Debug for StructOfStructs {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for StructOfStructs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("StructOfStructs")
.field("a", &self.a())
.field("b", &self.b())
@@ -44,7 +48,7 @@ impl<'b> flatbuffers::Push for StructOfStructs {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -55,7 +59,7 @@ impl<'b> flatbuffers::Push for &'b StructOfStructs {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
::core::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct StructOfStructsOfStructs, aligned to 4
@@ -13,8 +17,8 @@ impl Default for StructOfStructsOfStructs {
Self([0; 20])
}
}
impl std::fmt::Debug for StructOfStructsOfStructs {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for StructOfStructsOfStructs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("StructOfStructsOfStructs")
.field("a", &self.a())
.finish()
@@ -42,7 +46,7 @@ impl<'b> flatbuffers::Push for StructOfStructsOfStructs {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, Self::size())
::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -53,7 +57,7 @@ impl<'b> flatbuffers::Push for &'b StructOfStructsOfStructs {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const StructOfStructsOfStructs as *const u8, Self::size())
::core::slice::from_raw_parts(*self as *const StructOfStructsOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Test, aligned to 2
@@ -13,8 +17,8 @@ impl Default for Test {
Self([0; 4])
}
}
impl std::fmt::Debug for Test {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for Test {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Test")
.field("a", &self.a())
.field("b", &self.b())
@@ -43,7 +47,7 @@ impl<'b> flatbuffers::Push for Test {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
::core::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -54,7 +58,7 @@ impl<'b> flatbuffers::Push for &'b Test {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
::core::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
};
dst.copy_from_slice(src);
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TestSimpleTableWithEnumOffset {}
@@ -101,8 +105,8 @@ impl<'a: 'b, 'b> TestSimpleTableWithEnumBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for TestSimpleTableWithEnum<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for TestSimpleTableWithEnum<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TestSimpleTableWithEnum");
ds.field("color", &self.color());
ds.finish()

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TypeAliasesOffset {}
@@ -270,8 +274,8 @@ impl<'a: 'b, 'b> TypeAliasesBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for TypeAliases<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for TypeAliases<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TypeAliases");
ds.field("i8_", &self.i8_());
ds.field("u8_", &self.u8_());

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Vec3, aligned to 8
@@ -13,8 +17,8 @@ impl Default for Vec3 {
Self([0; 32])
}
}
impl std::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for Vec3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Vec3")
.field("x", &self.x())
.field("y", &self.y())
@@ -47,7 +51,7 @@ impl<'b> flatbuffers::Push for Vec3 {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
::core::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -58,7 +62,7 @@ impl<'b> flatbuffers::Push for &'b Vec3 {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
::core::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum MonsterOffset {}
@@ -85,8 +89,8 @@ impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for Monster<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Monster");
ds.finish()
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum InParentNamespaceOffset {}
@@ -85,8 +89,8 @@ impl<'a: 'b, 'b> InParentNamespaceBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for InParentNamespace<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for InParentNamespace<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("InParentNamespace");
ds.finish()
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
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.")]
@@ -34,8 +38,8 @@ impl FromInclude {
}
}
}
impl std::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for FromInclude {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
@@ -103,8 +107,8 @@ impl<'a: 'b, 'b> TableBBuilder<'a, 'b> {
}
}
impl std::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for TableB<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Unused, aligned to 4
@@ -13,8 +17,8 @@ impl Default for Unused {
Self([0; 4])
}
}
impl std::fmt::Debug for Unused {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl core::fmt::Debug for Unused {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
@@ -42,7 +46,7 @@ impl<'b> flatbuffers::Push for Unused {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -53,7 +57,7 @@ impl<'b> flatbuffers::Push for &'b Unused {
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
::std::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
::core::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}

View File

@@ -1,7 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
extern crate alloc;
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableAOffset {}
@@ -103,8 +107,8 @@ impl<'a: 'b, 'b> TableABuilder<'a, 'b> {
}
}
impl std::fmt::Debug for TableA<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Debug for TableA<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b());
ds.finish()