mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 15:08:20 +00:00
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:
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -15,8 +19,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())
|
||||
@@ -45,7 +49,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);
|
||||
}
|
||||
@@ -56,7 +60,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);
|
||||
}
|
||||
@@ -129,7 +133,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)
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -48,8 +52,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 {
|
||||
@@ -146,7 +150,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 {
|
||||
@@ -167,7 +171,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 {
|
||||
@@ -188,7 +192,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 {
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -48,8 +52,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 {
|
||||
@@ -146,7 +150,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 {
|
||||
@@ -167,7 +171,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 {
|
||||
@@ -188,7 +192,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 {
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -48,8 +52,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 {
|
||||
@@ -146,7 +150,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 {
|
||||
@@ -167,7 +171,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 {
|
||||
@@ -188,7 +192,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 {
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -381,7 +385,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)
|
||||
}
|
||||
@@ -1335,8 +1339,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());
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -48,8 +52,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 {
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -59,7 +63,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)
|
||||
}
|
||||
@@ -124,8 +128,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()
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -77,7 +81,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)
|
||||
}
|
||||
@@ -162,8 +166,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());
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -15,8 +19,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())
|
||||
@@ -46,7 +50,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);
|
||||
}
|
||||
@@ -57,7 +61,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -15,8 +19,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()
|
||||
@@ -44,7 +48,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);
|
||||
}
|
||||
@@ -55,7 +59,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -15,8 +19,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())
|
||||
@@ -45,7 +49,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);
|
||||
}
|
||||
@@ -56,7 +60,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -114,8 +118,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()
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -302,8 +306,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_());
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -15,8 +19,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())
|
||||
@@ -49,7 +53,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);
|
||||
}
|
||||
@@ -60,7 +64,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -97,8 +101,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()
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -97,8 +101,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()
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -36,8 +40,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 {
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -120,8 +124,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()
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -15,8 +19,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()
|
||||
@@ -44,7 +48,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);
|
||||
}
|
||||
@@ -55,7 +59,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
@@ -120,8 +124,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()
|
||||
|
||||
Reference in New Issue
Block a user