mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 07:27:27 +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;
|
||||
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.")]
|
||||
@@ -42,8 +46,8 @@ impl Color {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for Color {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for Color {
|
||||
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;
|
||||
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.")]
|
||||
@@ -38,8 +42,8 @@ impl Equipment {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for Equipment {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for Equipment {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
@@ -121,7 +125,7 @@ impl EquipmentT {
|
||||
/// If the union variant matches, return the owned WeaponT, setting the union to NONE.
|
||||
pub fn take_weapon(&mut self) -> Option<Box<WeaponT>> {
|
||||
if let Self::Weapon(_) = self {
|
||||
let v = std::mem::replace(self, Self::NONE);
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::Weapon(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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum MonsterOffset {}
|
||||
@@ -266,8 +270,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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
// struct Vec3, aligned to 4
|
||||
@@ -13,8 +17,8 @@ impl Default for Vec3 {
|
||||
Self([0; 12])
|
||||
}
|
||||
}
|
||||
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())
|
||||
@@ -44,7 +48,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);
|
||||
}
|
||||
@@ -55,7 +59,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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum WeaponOffset {}
|
||||
@@ -118,8 +122,8 @@ impl<'a: 'b, 'b> WeaponBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Weapon<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for Weapon<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Weapon");
|
||||
ds.field("name", &self.name());
|
||||
ds.field("damage", &self.damage());
|
||||
|
||||
@@ -367,9 +367,13 @@ class RustGenerator : public BaseGenerator {
|
||||
if (symbol.generated) continue;
|
||||
code_.Clear();
|
||||
code_ += "// " + std::string(FlatBuffersGeneratedWarning());
|
||||
code_ += "extern crate alloc;";
|
||||
code_ += "extern crate flatbuffers;";
|
||||
code_ += "use std::mem;";
|
||||
code_ += "use std::cmp::Ordering;";
|
||||
code_ += "use alloc::boxed::Box;";
|
||||
code_ += "use alloc::string::{String, ToString};";
|
||||
code_ += "use alloc::vec::Vec;";
|
||||
code_ += "use core::mem;";
|
||||
code_ += "use core::cmp::Ordering;";
|
||||
if (parser_.opts.rust_serialize) {
|
||||
code_ += "extern crate serde;";
|
||||
code_ +=
|
||||
@@ -786,10 +790,10 @@ class RustGenerator : public BaseGenerator {
|
||||
code_ += "}";
|
||||
|
||||
// Generate Debug. Unknown variants are printed like "<UNKNOWN 42>".
|
||||
code_ += "impl std::fmt::Debug for {{ENUM_TY}} {";
|
||||
code_ += "impl core::fmt::Debug for {{ENUM_TY}} {";
|
||||
code_ +=
|
||||
" fn fmt(&self, f: &mut std::fmt::Formatter) ->"
|
||||
" std::fmt::Result {";
|
||||
" fn fmt(&self, f: &mut core::fmt::Formatter) ->"
|
||||
" core::fmt::Result {";
|
||||
code_ += " if let Some(name) = self.variant_name() {";
|
||||
code_ += " f.write_str(name)";
|
||||
code_ += " } else {";
|
||||
@@ -964,7 +968,7 @@ class RustGenerator : public BaseGenerator {
|
||||
"pub fn take_{{U_ELEMENT_NAME}}(&mut self) -> "
|
||||
"Option<Box<{{U_ELEMENT_TABLE_TYPE}}>> {";
|
||||
code_ += " if let Self::{{NATIVE_VARIANT}}(_) = self {";
|
||||
code_ += " let v = std::mem::replace(self, Self::NONE);";
|
||||
code_ += " let v = core::mem::replace(self, Self::NONE);";
|
||||
code_ += " if let Self::{{NATIVE_VARIANT}}(w) = v {";
|
||||
code_ += " Some(w)";
|
||||
code_ += " } else {";
|
||||
@@ -2121,10 +2125,10 @@ class RustGenerator : public BaseGenerator {
|
||||
code_ += "}";
|
||||
code_ += "";
|
||||
|
||||
code_ += "impl std::fmt::Debug for {{STRUCT_TY}}<'_> {";
|
||||
code_ += "impl core::fmt::Debug for {{STRUCT_TY}}<'_> {";
|
||||
code_ +=
|
||||
" fn fmt(&self, f: &mut std::fmt::Formatter<'_>"
|
||||
") -> std::fmt::Result {";
|
||||
" fn fmt(&self, f: &mut core::fmt::Formatter<'_>"
|
||||
") -> core::fmt::Result {";
|
||||
code_ += " let mut ds = f.debug_struct(\"{{STRUCT_TY}}\");";
|
||||
ForAllTableFields(struct_def, [&](const FieldDef &field) {
|
||||
if (GetFullType(field.value.type) == ftUnionValue) {
|
||||
@@ -2344,7 +2348,7 @@ class RustGenerator : public BaseGenerator {
|
||||
code_ += "#[inline]";
|
||||
code_ +=
|
||||
"pub fn key_compare_with_value(&self, val: {{KEY_TYPE}}) -> "
|
||||
"::std::cmp::Ordering {";
|
||||
"::core::cmp::Ordering {";
|
||||
code_ += " let key = self.{{FIELD}}();";
|
||||
code_ += " key.cmp({{REF}}val)";
|
||||
code_ += "}";
|
||||
@@ -2604,10 +2608,10 @@ class RustGenerator : public BaseGenerator {
|
||||
code_ += "}";
|
||||
|
||||
// Debug for structs.
|
||||
code_ += "impl std::fmt::Debug for {{STRUCT_TY}} {";
|
||||
code_ += "impl core::fmt::Debug for {{STRUCT_TY}} {";
|
||||
code_ +=
|
||||
" fn fmt(&self, f: &mut std::fmt::Formatter"
|
||||
") -> std::fmt::Result {";
|
||||
" fn fmt(&self, f: &mut core::fmt::Formatter"
|
||||
") -> core::fmt::Result {";
|
||||
code_ += " f.debug_struct(\"{{STRUCT_TY}}\")";
|
||||
ForAllStructFields(struct_def, [&](const FieldDef &unused) {
|
||||
(void)unused;
|
||||
@@ -2643,7 +2647,7 @@ class RustGenerator : public BaseGenerator {
|
||||
code_ += " fn push(&self, dst: &mut [u8], _rest: &[u8]) {";
|
||||
code_ += " let src = unsafe {";
|
||||
code_ +=
|
||||
" ::std::slice::from_raw_parts("
|
||||
" ::core::slice::from_raw_parts("
|
||||
"self as *const {{STRUCT_TY}} as *const u8, Self::size())";
|
||||
code_ += " };";
|
||||
code_ += " dst.copy_from_slice(src);";
|
||||
@@ -2656,7 +2660,7 @@ class RustGenerator : public BaseGenerator {
|
||||
code_ += " fn push(&self, dst: &mut [u8], _rest: &[u8]) {";
|
||||
code_ += " let src = unsafe {";
|
||||
code_ +=
|
||||
" ::std::slice::from_raw_parts("
|
||||
" ::core::slice::from_raw_parts("
|
||||
"*self as *const {{STRUCT_TY}} as *const u8, Self::size())";
|
||||
code_ += " };";
|
||||
code_ += " dst.copy_from_slice(src);";
|
||||
@@ -2788,7 +2792,7 @@ class RustGenerator : public BaseGenerator {
|
||||
NumToString(InlineSize(field.value.type)));
|
||||
code_ += "pub fn set_{{FIELD}}(&mut self, x: &{{FIELD_TYPE}}) {";
|
||||
code_ += " unsafe {";
|
||||
code_ += " std::ptr::copy(";
|
||||
code_ += " core::ptr::copy(";
|
||||
code_ += " x.as_ptr() as *const u8,";
|
||||
code_ += " self.0.as_mut_ptr().add({{FIELD_OFFSET}}),";
|
||||
code_ += " {{FIELD_SIZE}},";
|
||||
@@ -2901,8 +2905,8 @@ class RustGenerator : public BaseGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
code_ += indent + "use std::mem;";
|
||||
code_ += indent + "use std::cmp::Ordering;";
|
||||
code_ += indent + "use core::mem;";
|
||||
code_ += indent + "use core::cmp::Ordering;";
|
||||
code_ += "";
|
||||
if (parser_.opts.rust_serialize) {
|
||||
code_ += indent + "extern crate serde;";
|
||||
|
||||
@@ -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 ArrayStruct, aligned to 8
|
||||
@@ -13,8 +17,8 @@ impl Default for ArrayStruct {
|
||||
Self([0; 160])
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for ArrayStruct {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ArrayStruct {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("ArrayStruct")
|
||||
.field("a", &self.a())
|
||||
.field("b", &self.b())
|
||||
@@ -47,7 +51,7 @@ impl<'b> flatbuffers::Push for ArrayStruct {
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(self as *const ArrayStruct as *const u8, Self::size())
|
||||
::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, Self::size())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
@@ -58,7 +62,7 @@ impl<'b> flatbuffers::Push for &'b ArrayStruct {
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(*self as *const ArrayStruct as *const u8, Self::size())
|
||||
::core::slice::from_raw_parts(*self as *const ArrayStruct as *const u8, Self::size())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
@@ -158,7 +162,7 @@ impl<'a> ArrayStruct {
|
||||
|
||||
pub fn set_d(&mut self, x: &[NestedStruct; 2]) {
|
||||
unsafe {
|
||||
std::ptr::copy(
|
||||
core::ptr::copy(
|
||||
x.as_ptr() as *const u8,
|
||||
self.0.as_mut_ptr().add(72),
|
||||
64,
|
||||
|
||||
@@ -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 ArrayTableOffset {}
|
||||
@@ -103,8 +107,8 @@ impl<'a: 'b, 'b> ArrayTableBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ArrayTable<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ArrayTable<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("ArrayTable");
|
||||
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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
// struct NestedStruct, aligned to 8
|
||||
@@ -13,8 +17,8 @@ impl Default for NestedStruct {
|
||||
Self([0; 32])
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for NestedStruct {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for NestedStruct {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("NestedStruct")
|
||||
.field("a", &self.a())
|
||||
.field("b", &self.b())
|
||||
@@ -45,7 +49,7 @@ impl<'b> flatbuffers::Push for NestedStruct {
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(self as *const NestedStruct as *const u8, Self::size())
|
||||
::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, Self::size())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
@@ -56,7 +60,7 @@ impl<'b> flatbuffers::Push for &'b NestedStruct {
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(*self as *const NestedStruct as *const u8, Self::size())
|
||||
::core::slice::from_raw_parts(*self as *const NestedStruct as *const u8, Self::size())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
@@ -129,7 +133,7 @@ impl<'a> NestedStruct {
|
||||
|
||||
pub fn set_c(&mut self, x: &[TestEnum; 2]) {
|
||||
unsafe {
|
||||
std::ptr::copy(
|
||||
core::ptr::copy(
|
||||
x.as_ptr() as *const u8,
|
||||
self.0.as_mut_ptr().add(9),
|
||||
2,
|
||||
|
||||
@@ -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.")]
|
||||
@@ -42,8 +46,8 @@ impl TestEnum {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for TestEnum {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for TestEnum {
|
||||
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;
|
||||
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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.")]
|
||||
@@ -42,8 +46,8 @@ impl ABC {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for ABC {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ABC {
|
||||
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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum KeywordsInTableOffset {}
|
||||
@@ -146,8 +150,8 @@ impl<'a: 'b, 'b> KeywordsInTableBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for KeywordsInTable<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for KeywordsInTable<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("KeywordsInTable");
|
||||
ds.field("is", &self.is());
|
||||
ds.field("private", &self.private());
|
||||
|
||||
@@ -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.")]
|
||||
@@ -42,8 +46,8 @@ impl KeywordsInUnion {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for KeywordsInUnion {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for KeywordsInUnion {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
@@ -128,7 +132,7 @@ impl KeywordsInUnionT {
|
||||
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
|
||||
pub fn take_static_(&mut self) -> Option<Box<KeywordsInTableT>> {
|
||||
if let Self::Static_(_) = self {
|
||||
let v = std::mem::replace(self, Self::NONE);
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::Static_(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
@@ -149,7 +153,7 @@ impl KeywordsInUnionT {
|
||||
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
|
||||
pub fn take_internal(&mut self) -> Option<Box<KeywordsInTableT>> {
|
||||
if let Self::Internal(_) = self {
|
||||
let v = std::mem::replace(self, Self::NONE);
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::Internal(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;
|
||||
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 public {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for public {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for public {
|
||||
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;
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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_());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.")]
|
||||
@@ -42,8 +46,8 @@ impl ABC {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for ABC {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ABC {
|
||||
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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum MoreDefaultsOffset {}
|
||||
@@ -194,8 +198,8 @@ impl<'a: 'b, 'b> MoreDefaultsBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for MoreDefaults<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for MoreDefaults<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("MoreDefaults");
|
||||
ds.field("ints", &self.ints());
|
||||
ds.field("floats", &self.floats());
|
||||
|
||||
@@ -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.")]
|
||||
@@ -42,8 +46,8 @@ impl EnumInNestedNS {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for EnumInNestedNS {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for EnumInNestedNS {
|
||||
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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
// struct StructInNestedNS, aligned to 4
|
||||
@@ -13,8 +17,8 @@ impl Default for StructInNestedNS {
|
||||
Self([0; 8])
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for StructInNestedNS {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for StructInNestedNS {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("StructInNestedNS")
|
||||
.field("a", &self.a())
|
||||
.field("b", &self.b())
|
||||
@@ -43,7 +47,7 @@ impl<'b> flatbuffers::Push for StructInNestedNS {
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size())
|
||||
::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
@@ -54,7 +58,7 @@ impl<'b> flatbuffers::Push for &'b StructInNestedNS {
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(*self as *const StructInNestedNS as *const u8, Self::size())
|
||||
::core::slice::from_raw_parts(*self as *const StructInNestedNS 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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum TableInNestedNSOffset {}
|
||||
@@ -101,8 +105,8 @@ impl<'a: 'b, 'b> TableInNestedNSBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for TableInNestedNS<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for TableInNestedNS<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableInNestedNS");
|
||||
ds.field("foo", &self.foo());
|
||||
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;
|
||||
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.")]
|
||||
@@ -38,8 +42,8 @@ impl UnionInNestedNS {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for UnionInNestedNS {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for UnionInNestedNS {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
@@ -121,7 +125,7 @@ impl UnionInNestedNST {
|
||||
/// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE.
|
||||
pub fn take_table_in_nested_ns(&mut self) -> Option<Box<TableInNestedNST>> {
|
||||
if let Self::TableInNestedNS(_) = self {
|
||||
let v = std::mem::replace(self, Self::NONE);
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::TableInNestedNS(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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum SecondTableInAOffset {}
|
||||
@@ -103,8 +107,8 @@ impl<'a: 'b, 'b> SecondTableInABuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for SecondTableInA<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for SecondTableInA<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("SecondTableInA");
|
||||
ds.field("refer_to_c", &self.refer_to_c());
|
||||
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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum TableInFirstNSOffset {}
|
||||
@@ -185,8 +189,8 @@ impl<'a: 'b, 'b> TableInFirstNSBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for TableInFirstNS<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for TableInFirstNS<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableInFirstNS");
|
||||
ds.field("foo_table", &self.foo_table());
|
||||
ds.field("foo_enum", &self.foo_enum());
|
||||
|
||||
@@ -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 TableInCOffset {}
|
||||
@@ -120,8 +124,8 @@ impl<'a: 'b, 'b> TableInCBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for TableInC<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for TableInC<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableInC");
|
||||
ds.field("refer_to_a1", &self.refer_to_a1());
|
||||
ds.field("refer_to_a2", &self.refer_to_a2());
|
||||
|
||||
@@ -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.")]
|
||||
@@ -42,8 +46,8 @@ impl OptionalByte {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for OptionalByte {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for OptionalByte {
|
||||
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;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum ScalarStuffOffset {}
|
||||
@@ -626,8 +630,8 @@ impl<'a: 'b, 'b> ScalarStuffBuilder<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ScalarStuff<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ScalarStuff<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("ScalarStuff");
|
||||
ds.field("just_i8", &self.just_i8());
|
||||
ds.field("maybe_i8", &self.maybe_i8());
|
||||
|
||||
@@ -4,6 +4,7 @@ version = "0.1.0"
|
||||
authors = ["Robert Winslow <hello@rwinslow.com>",
|
||||
"Casper Neo <cneo@google.com>",
|
||||
"FlatBuffers Maintainers"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
flatbuffers = { path = "../../rust/flatbuffers", default-features = false }
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use bencher::{benchmark_group, Bencher};
|
||||
use flatbuffers;
|
||||
use bencher::Bencher;
|
||||
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../monster_test/mod.rs"]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use bencher::Bencher;
|
||||
use bencher::{benchmark_group, benchmark_main, Bencher};
|
||||
use flexbuffers::*;
|
||||
|
||||
fn push_vec_u64_to_map(b: &mut Bencher) {
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
#![no_std]
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
extern crate std;
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
extern crate array_init;
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../arrays_test/mod.rs"]
|
||||
mod arrays_test_generated;
|
||||
use std::fmt::Debug;
|
||||
use alloc::format;
|
||||
use core::fmt::Debug;
|
||||
|
||||
use crate::arrays_test_generated::my_game::example::*;
|
||||
extern crate quickcheck;
|
||||
use array_init::array_init;
|
||||
use std::mem::size_of;
|
||||
use core::mem::size_of;
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
|
||||
|
||||
fn create_serialized_example_with_generated_code(builder: &mut flatbuffers::FlatBufferBuilder) {
|
||||
let nested_struct1 = NestedStruct::new(
|
||||
&[-1, 2],
|
||||
@@ -111,12 +118,12 @@ fn generated_code_creates_correct_example() {
|
||||
|
||||
#[test]
|
||||
fn struct_netsted_struct_is_32_bytes() {
|
||||
assert_eq!(32, ::std::mem::size_of::<NestedStruct>());
|
||||
assert_eq!(32, ::core::mem::size_of::<NestedStruct>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_array_struct_is_160_bytes() {
|
||||
assert_eq!(160, ::std::mem::size_of::<ArrayStruct>());
|
||||
assert_eq!(160, ::core::mem::size_of::<ArrayStruct>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -228,7 +235,7 @@ fn verify_struct_array_alignment() {
|
||||
let b_start_ptr = array_struct.b().as_ptr() as usize;
|
||||
let d_start_ptr = array_struct.d().as_ptr() as usize;
|
||||
// The T type of b
|
||||
let b_aln = ::std::mem::align_of::<i32>();
|
||||
let b_aln = ::core::mem::align_of::<i32>();
|
||||
assert_eq!((b_start_ptr - struct_start_ptr) % b_aln, 0);
|
||||
assert_eq!((d_start_ptr - b_start_ptr) % b_aln, 0);
|
||||
assert_eq!((d_start_ptr - struct_start_ptr) % 8, 0);
|
||||
|
||||
@@ -115,7 +115,6 @@ quickcheck! {
|
||||
let mut expected = x.to_le_bytes().to_vec();
|
||||
expected.push(3 << 2 | 2); // Float W32.
|
||||
expected.push(4); // Root width W32.
|
||||
println!("{:?}: {:?} vs {:?} cmp {:?}", x, &fxb, &expected, fxb==expected);
|
||||
fxb == expected
|
||||
}
|
||||
}
|
||||
@@ -321,7 +320,7 @@ fn indirect_numbers() {
|
||||
v.push(IndirectUInt(u64::max_value()));
|
||||
v.push(IndirectInt(i64::min_value()));
|
||||
// TODO(cneo): Something about Float EPSILON and casting leads to a different binary format.
|
||||
v.push(IndirectFloat(std::f64::consts::PI));
|
||||
v.push(IndirectFloat(core::f64::consts::PI));
|
||||
v.push(0u32); // This is stored in 8 bits instead of 64 because of indirection.
|
||||
v.end_vector();
|
||||
assert_eq!(
|
||||
@@ -385,7 +384,6 @@ fn indirect_2p5x_smaller() {
|
||||
v.push(IndirectInt(i64::max_value()));
|
||||
v.end_vector();
|
||||
let len_with_indirect = builder.view().len() as f32;
|
||||
dbg!(len_with_indirect, len_without_indirect);
|
||||
assert!(len_with_indirect * 2.5 < len_without_indirect);
|
||||
}
|
||||
#[test]
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
mod binary_format;
|
||||
#[cfg(not(feature = "no_std"))] // uses file I/O
|
||||
mod interop;
|
||||
mod other_api;
|
||||
#[cfg(not(miri))] // slow.
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use flexbuffers::*;
|
||||
#[cfg(not(miri))] // slow.
|
||||
use quickcheck::QuickCheck;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
use alloc::collections::BTreeMap;
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use super::rwyw::NonNullString;
|
||||
use flexbuffers::*;
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
enum Enum {
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
|
||||
// Read what you wrote.
|
||||
use flexbuffers::*;
|
||||
#[cfg(not(miri))] // slow.
|
||||
@@ -23,7 +26,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct NonNullString(String);
|
||||
impl quickcheck::Arbitrary for NonNullString {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
let size = std::cmp::min(1, usize::arbitrary(g));
|
||||
let size = core::cmp::min(1, usize::arbitrary(g));
|
||||
NonNullString(
|
||||
(0..)
|
||||
.map(|_| <char>::arbitrary(g))
|
||||
@@ -74,7 +77,7 @@ quickcheck! {
|
||||
}
|
||||
v.end_vector();
|
||||
let r = Reader::get_root(builder.view()).unwrap().as_vector();
|
||||
xs.iter().enumerate().all(|(i, &x)| (r.idx(i).as_f64() - x).abs() < std::f64::EPSILON)
|
||||
xs.iter().enumerate().all(|(i, &x)| (r.idx(i).as_f64() - x).abs() < core::f64::EPSILON)
|
||||
}
|
||||
fn qc_vec_string(xs: Vec<String>) -> bool {
|
||||
let mut builder = Builder::default();
|
||||
@@ -86,6 +89,7 @@ quickcheck! {
|
||||
let r = Reader::get_root(builder.view()).unwrap().as_vector();
|
||||
xs.iter().enumerate().all(|(i, x)| (r.idx(i).as_str() == x))
|
||||
}
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
fn qc_map_int(xs: std::collections::BTreeMap<NonNullString, i64>) -> bool {
|
||||
let mut builder = Builder::default();
|
||||
let mut m = builder.start_map();
|
||||
@@ -98,6 +102,7 @@ quickcheck! {
|
||||
r.idx(i).as_i64() == v && r.idx(k.0.as_str()).as_i64() == v
|
||||
})
|
||||
}
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
fn qc_map_string(xs: std::collections::BTreeMap<NonNullString, String>) -> bool {
|
||||
let mut builder = Builder::default();
|
||||
let mut m = builder.start_map();
|
||||
@@ -195,7 +200,6 @@ fn empty_vectors() {
|
||||
let foo1 = Foo::default();
|
||||
let mut s = FlexbufferSerializer::new();
|
||||
foo1.serialize(&mut s).unwrap();
|
||||
dbg!(s.view());
|
||||
let r = Reader::get_root(s.view()).unwrap();
|
||||
let foo2 = Foo::deserialize(r).unwrap();
|
||||
assert_eq!(foo1, foo2);
|
||||
|
||||
@@ -15,6 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#![no_std]
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
extern crate std;
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::string::String;
|
||||
|
||||
#[cfg(feature = "no_std")]
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: libc_alloc::LibcAlloc = libc_alloc::LibcAlloc;
|
||||
@@ -392,9 +404,9 @@ fn verifier_one_byte_errors_do_not_crash() {
|
||||
// If the verifier says a buffer is okay then using it won't cause a crash.
|
||||
// We use write_fmt since Debug visits all the fields - but there's no need to store anything.
|
||||
struct ForgetfulWriter;
|
||||
use std::fmt::Write;
|
||||
use core::fmt::Write;
|
||||
impl Write for ForgetfulWriter {
|
||||
fn write_str(&mut self, _: &str) -> Result<(), std::fmt::Error> {
|
||||
fn write_str(&mut self, _: &str) -> Result<(), core::fmt::Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -442,7 +454,7 @@ fn verifier_apparent_size_too_large() {
|
||||
let b = &mut flatbuffers::FlatBufferBuilder::new();
|
||||
let name = Some(b.create_string("foo"));
|
||||
// String amplification attack.
|
||||
let s = b.create_string(&(std::iter::repeat("X").take(1000).collect::<String>()));
|
||||
let s = b.create_string(&(core::iter::repeat("X").take(1000).collect::<String>()));
|
||||
let testarrayofstring = Some(b.create_vector(&vec![s; 1000]));
|
||||
let m = Monster::create(b, &MonsterArgs {
|
||||
testarrayofstring,
|
||||
@@ -541,11 +553,12 @@ mod generated_constants {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(test)]
|
||||
mod lifetime_correctness {
|
||||
extern crate flatbuffers;
|
||||
|
||||
use std::mem;
|
||||
use core::mem;
|
||||
|
||||
use super::my_game;
|
||||
use super::load_file;
|
||||
@@ -593,6 +606,8 @@ mod lifetime_correctness {
|
||||
mod roundtrip_generated_code {
|
||||
extern crate flatbuffers;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use super::my_game;
|
||||
|
||||
fn build_mon<'a, 'b>(builder: &'a mut flatbuffers::FlatBufferBuilder, args: &'b my_game::example::MonsterArgs) -> my_game::example::Monster<'a> {
|
||||
@@ -988,25 +1003,25 @@ mod generated_code_alignment_and_padding {
|
||||
|
||||
#[test]
|
||||
fn enum_color_is_1_byte() {
|
||||
assert_eq!(1, ::std::mem::size_of::<my_game::example::Color>());
|
||||
assert_eq!(1, ::core::mem::size_of::<my_game::example::Color>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn union_any_is_1_byte() {
|
||||
assert_eq!(1, ::std::mem::size_of::<my_game::example::Any>());
|
||||
assert_eq!(1, ::core::mem::size_of::<my_game::example::Any>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn union_any_is_aligned_to_1() {
|
||||
assert_eq!(1, ::std::mem::align_of::<my_game::example::Any>());
|
||||
assert_eq!(1, ::core::mem::align_of::<my_game::example::Any>());
|
||||
}
|
||||
#[test]
|
||||
fn struct_test_is_4_bytes() {
|
||||
assert_eq!(4, ::std::mem::size_of::<my_game::example::Test>());
|
||||
assert_eq!(4, ::core::mem::size_of::<my_game::example::Test>());
|
||||
}
|
||||
#[test]
|
||||
fn struct_vec3_is_32_bytes() {
|
||||
assert_eq!(32, ::std::mem::size_of::<my_game::example::Vec3>());
|
||||
assert_eq!(32, ::core::mem::size_of::<my_game::example::Vec3>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1036,7 +1051,7 @@ mod generated_code_alignment_and_padding {
|
||||
|
||||
#[test]
|
||||
fn struct_ability_is_8_bytes() {
|
||||
assert_eq!(8, ::std::mem::size_of::<my_game::example::Ability>());
|
||||
assert_eq!(8, ::core::mem::size_of::<my_game::example::Ability>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1061,7 +1076,7 @@ mod generated_code_alignment_and_padding {
|
||||
for a in abilities.iter() {
|
||||
let a_ptr = a as *const my_game::example::Ability as usize;
|
||||
assert!(a_ptr > start_ptr);
|
||||
let aln = ::std::mem::align_of::<my_game::example::Ability>();
|
||||
let aln = ::core::mem::align_of::<my_game::example::Ability>();
|
||||
assert_eq!((a_ptr - start_ptr) % aln, 0);
|
||||
}
|
||||
for a in abilities.iter().rev() {
|
||||
@@ -1166,6 +1181,8 @@ mod roundtrip_vectors {
|
||||
extern crate quickcheck;
|
||||
extern crate flatbuffers;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
const N: u64 = 20;
|
||||
|
||||
fn prop<T>(xs: Vec<T>)
|
||||
@@ -1173,7 +1190,7 @@ mod roundtrip_vectors {
|
||||
T: for<'a> flatbuffers::Follow<'a, Inner = T>
|
||||
+ flatbuffers::EndianScalar
|
||||
+ flatbuffers::Push
|
||||
+ ::std::fmt::Debug,
|
||||
+ ::core::fmt::Debug,
|
||||
{
|
||||
use flatbuffers::Follow;
|
||||
|
||||
@@ -1247,7 +1264,7 @@ mod roundtrip_vectors {
|
||||
// complicated.
|
||||
macro_rules! impl_prop {
|
||||
($test_name:ident, $fn_name:ident, $ty:ident) => (
|
||||
fn $fn_name(xs: Vec<$ty>) {
|
||||
fn $fn_name(xs: alloc::vec::Vec<$ty>) {
|
||||
use flatbuffers::Follow;
|
||||
|
||||
let mut b = flatbuffers::FlatBufferBuilder::new();
|
||||
@@ -1258,7 +1275,7 @@ mod roundtrip_vectors {
|
||||
assert_eq!(got, &xs[..]);
|
||||
}
|
||||
#[test]
|
||||
fn $test_name() { quickcheck::QuickCheck::new().max_tests(N).quickcheck($fn_name as fn(Vec<_>)); }
|
||||
fn $test_name() { quickcheck::QuickCheck::new().max_tests(N).quickcheck($fn_name as fn(alloc::vec::Vec<_>)); }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1289,6 +1306,9 @@ mod roundtrip_vectors {
|
||||
extern crate quickcheck;
|
||||
extern crate flatbuffers;
|
||||
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
fn prop(xs: Vec<String>) {
|
||||
use flatbuffers::Follow;
|
||||
|
||||
@@ -1327,6 +1347,9 @@ mod roundtrip_vectors {
|
||||
extern crate quickcheck;
|
||||
extern crate flatbuffers;
|
||||
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
fn prop(input: Vec<String>) {
|
||||
let xs: Vec<&str> = input.iter().map(|s: &String| &s[..]).collect();
|
||||
|
||||
@@ -1358,6 +1381,8 @@ mod roundtrip_vectors {
|
||||
extern crate quickcheck;
|
||||
extern crate flatbuffers;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[cfg(not(miri))] // slow.
|
||||
#[test]
|
||||
fn fuzz_manual_build() {
|
||||
@@ -1409,8 +1434,11 @@ mod framing_format {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(test)]
|
||||
mod roundtrip_table {
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
use std::collections::HashMap;
|
||||
|
||||
extern crate flatbuffers;
|
||||
@@ -1429,9 +1457,9 @@ mod roundtrip_table {
|
||||
let uchar_val: u8 = 0xFF;
|
||||
let short_val: i16 = -32222; // 0x8222;
|
||||
let ushort_val: u16 = 0xFEEE;
|
||||
let int_val: i32 = unsafe { ::std::mem::transmute(0x83333333u32) };
|
||||
let int_val: i32 = unsafe { ::core::mem::transmute(0x83333333u32) };
|
||||
let uint_val: u32 = 0xFDDDDDDD;
|
||||
let long_val: i64 = unsafe { ::std::mem::transmute(0x8444444444444444u64) }; // TODO: byte literal?
|
||||
let long_val: i64 = unsafe { ::core::mem::transmute(0x8444444444444444u64) }; // TODO: byte literal?
|
||||
let ulong_val: u64 = 0xFCCCCCCCCCCCCCCCu64;
|
||||
let float_val: f32 = 3.14159;
|
||||
let double_val: f64 = 3.14159265359;
|
||||
@@ -1598,6 +1626,9 @@ mod roundtrip_table {
|
||||
|
||||
#[cfg(not(miri))] // slow.
|
||||
mod table_of_vectors_of_scalars {
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
extern crate flatbuffers;
|
||||
#[cfg(not(miri))] // slow.
|
||||
extern crate quickcheck;
|
||||
@@ -1609,7 +1640,7 @@ mod roundtrip_table {
|
||||
T: for<'a> flatbuffers::Follow<'a, Inner = T>
|
||||
+ flatbuffers::EndianScalar
|
||||
+ flatbuffers::Push
|
||||
+ ::std::fmt::Debug,
|
||||
+ ::core::fmt::Debug,
|
||||
{
|
||||
use flatbuffers::field_index_to_field_offset as fi2fo;
|
||||
use flatbuffers::Follow;
|
||||
@@ -1689,8 +1720,8 @@ mod roundtrip_scalars {
|
||||
|
||||
const N: u64 = 1000;
|
||||
|
||||
fn prop<T: PartialEq + ::std::fmt::Debug + Copy + flatbuffers::EndianScalar>(x: T) {
|
||||
let mut buf = vec![0u8; ::std::mem::size_of::<T>()];
|
||||
fn prop<T: PartialEq + ::core::fmt::Debug + Copy + flatbuffers::EndianScalar>(x: T) {
|
||||
let mut buf = vec![0u8; ::core::mem::size_of::<T>()];
|
||||
let y = unsafe {
|
||||
flatbuffers::emplace_scalar(&mut buf[..], x);
|
||||
flatbuffers::read_scalar(&buf[..])
|
||||
@@ -1742,7 +1773,7 @@ mod roundtrip_push_follow_scalars {
|
||||
macro_rules! impl_prop {
|
||||
($fn_name:ident, $ty:ident) => (
|
||||
fn $fn_name(x: $ty) {
|
||||
let mut buf = vec![0u8; ::std::mem::size_of::<$ty>()];
|
||||
let mut buf = vec![0u8; ::core::mem::size_of::<$ty>()];
|
||||
x.push(&mut buf[..], &[][..]);
|
||||
let fs: flatbuffers::FollowStart<$ty> = flatbuffers::FollowStart::new();
|
||||
assert_eq!(fs.self_follow(&buf[..], 0), x);
|
||||
@@ -1896,10 +1927,13 @@ mod write_and_read_examples {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(test)]
|
||||
mod read_examples_from_other_language_ports {
|
||||
extern crate flatbuffers;
|
||||
|
||||
use std::println;
|
||||
|
||||
use super::load_file;
|
||||
use super::serialized_example_is_accessible_and_correct;
|
||||
|
||||
@@ -1974,9 +2008,9 @@ mod generated_key_comparisons {
|
||||
fn struct_key_compare_with_value() {
|
||||
let a = my_game::example::Ability::new(1, 2);
|
||||
|
||||
assert_eq!(a.key_compare_with_value(0), ::std::cmp::Ordering::Greater);
|
||||
assert_eq!(a.key_compare_with_value(1), ::std::cmp::Ordering::Equal);
|
||||
assert_eq!(a.key_compare_with_value(2), ::std::cmp::Ordering::Less);
|
||||
assert_eq!(a.key_compare_with_value(0), ::core::cmp::Ordering::Greater);
|
||||
assert_eq!(a.key_compare_with_value(1), ::core::cmp::Ordering::Equal);
|
||||
assert_eq!(a.key_compare_with_value(2), ::core::cmp::Ordering::Less);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2010,9 +2044,9 @@ mod generated_key_comparisons {
|
||||
// preconditions
|
||||
assert_eq!(a.name(), "MyMonster");
|
||||
|
||||
assert_eq!(a.key_compare_with_value("AAA"), ::std::cmp::Ordering::Greater);
|
||||
assert_eq!(a.key_compare_with_value("MyMonster"), ::std::cmp::Ordering::Equal);
|
||||
assert_eq!(a.key_compare_with_value("ZZZ"), ::std::cmp::Ordering::Less);
|
||||
assert_eq!(a.key_compare_with_value("AAA"), ::core::cmp::Ordering::Greater);
|
||||
assert_eq!(a.key_compare_with_value("MyMonster"), ::core::cmp::Ordering::Equal);
|
||||
assert_eq!(a.key_compare_with_value("ZZZ"), ::core::cmp::Ordering::Less);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2116,6 +2150,8 @@ mod follow_impls {
|
||||
use flatbuffers::Follow;
|
||||
use flatbuffers::field_index_to_field_offset as fi2fo;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
// Define a test struct to use in a few tests. This replicates the work that the code generator
|
||||
// would normally do when defining a FlatBuffer struct. For reference, compare the following
|
||||
// `FooStruct` code with the code generated for the `Vec3` struct in
|
||||
@@ -2884,12 +2920,12 @@ mod byte_layouts {
|
||||
c: i8,
|
||||
_pad2: [u8; 4],
|
||||
}
|
||||
assert_eq!(::std::mem::size_of::<foo>(), 16);
|
||||
assert_eq!(::core::mem::size_of::<foo>(), 16);
|
||||
impl<'b> flatbuffers::Push for &'b foo {
|
||||
type Output = foo;
|
||||
fn push<'a>(&'a self, dst: &'a mut [u8], _rest: &'a [u8]) {
|
||||
let src = unsafe {
|
||||
::std::slice::from_raw_parts(*self as *const foo as *const u8, ::std::mem::size_of::<foo>())
|
||||
::core::slice::from_raw_parts(*self as *const foo as *const u8, ::core::mem::size_of::<foo>())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
@@ -3170,6 +3206,9 @@ mod byte_layouts {
|
||||
|
||||
#[cfg(test)]
|
||||
mod copy_clone_traits {
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[test]
|
||||
fn follow_types_implement_copy_and_clone() {
|
||||
static_assertions::assert_impl_all!(flatbuffers::WIPOffset<u32>: Copy, Clone);
|
||||
@@ -3187,17 +3226,18 @@ mod copy_clone_traits {
|
||||
mod fully_qualified_name {
|
||||
#[test]
|
||||
fn fully_qualified_name_generated() {
|
||||
assert!(check_eq!(::my_game::example::Monster::get_fully_qualified_name(), "MyGame.Example.Monster").is_ok());
|
||||
assert!(check_eq!(::my_game::example_2::Monster::get_fully_qualified_name(), "MyGame.Example2.Monster").is_ok());
|
||||
assert!(check_eq!(super::my_game::example::Monster::get_fully_qualified_name(), "MyGame.Example.Monster").is_ok());
|
||||
assert!(check_eq!(super::my_game::example_2::Monster::get_fully_qualified_name(), "MyGame.Example2.Monster").is_ok());
|
||||
|
||||
assert!(check_eq!(::my_game::example::Vec3::get_fully_qualified_name(), "MyGame.Example.Vec3").is_ok());
|
||||
assert!(check_eq!(::my_game::example::Ability::get_fully_qualified_name(), "MyGame.Example.Ability").is_ok());
|
||||
assert!(check_eq!(super::my_game::example::Vec3::get_fully_qualified_name(), "MyGame.Example.Vec3").is_ok());
|
||||
assert!(check_eq!(super::my_game::example::Ability::get_fully_qualified_name(), "MyGame.Example.Ability").is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
// this is not technically a test, but we want to always keep this generated
|
||||
// file up-to-date, and the simplest way to do that is to make sure that when
|
||||
// tests are run, the file is generated.
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[test]
|
||||
fn write_example_wire_data_to_file() {
|
||||
let b = &mut flatbuffers::FlatBufferBuilder::new();
|
||||
@@ -3208,6 +3248,7 @@ fn write_example_wire_data_to_file() {
|
||||
f.write_all(b.finished_data()).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
fn load_file(filename: &str) -> Result<Vec<u8>, std::io::Error> {
|
||||
use std::io::Read;
|
||||
let mut f = std::fs::File::open(filename)?;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::string::ToString;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../more_defaults/mod.rs"]
|
||||
mod more_defaults_generated;
|
||||
|
||||
Reference in New Issue
Block a user