blob: f3fcaabe5516b244e30247ff7f9de0df35da1373 [file] [log] [blame]
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
#[allow(unused_imports, dead_code)]
pub mod my_game {
extern crate alloc;
#[allow(unused_imports, dead_code)]
pub mod example {
extern crate alloc;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_TEST_ENUM: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_TEST_ENUM: i8 = 2;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_TEST_ENUM: [TestEnum; 3] = [
TestEnum::A,
TestEnum::B,
TestEnum::C,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct TestEnum(pub i8);
#[allow(non_upper_case_globals)]
impl TestEnum {
pub const A: Self = Self(0);
pub const B: Self = Self(1);
pub const C: Self = Self(2);
pub const ENUM_MIN: i8 = 0;
pub const ENUM_MAX: i8 = 2;
pub const ENUM_VALUES: &'static [Self] = &[
Self::A,
Self::B,
Self::C,
];
/// Returns the variant's name or "" if unknown.
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::A => Some("A"),
Self::B => Some("B"),
Self::C => Some("C"),
_ => None,
}
}
}
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 {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> ::flatbuffers::Follow<'a> for TestEnum {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
Self(b)
}
}
impl ::flatbuffers::Push for TestEnum {
type Output = TestEnum;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
}
}
impl ::flatbuffers::EndianScalar for TestEnum {
type Scalar = i8;
#[inline]
fn to_little_endian(self) -> i8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: i8) -> Self {
let b = i8::from_le(v);
Self(b)
}
}
impl<'a> ::flatbuffers::Verifiable for TestEnum {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
i8::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for TestEnum {}
// struct NestedStruct, aligned to 8
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct NestedStruct(pub [u8; 32]);
impl Default for NestedStruct {
fn default() -> Self {
Self([0; 32])
}
}
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())
.field("c", &self.c())
.field("d", &self.d())
.finish()
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for NestedStruct {}
impl<'a> ::flatbuffers::Follow<'a> for NestedStruct {
type Inner = &'a NestedStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a NestedStruct>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a NestedStruct {
type Inner = &'a NestedStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<NestedStruct>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for NestedStruct {
type Output = NestedStruct;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8)
}
}
impl<'a> ::flatbuffers::Verifiable for NestedStruct {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
impl<'a> NestedStruct {
#[allow(clippy::too_many_arguments)]
pub fn new(
a: &[i32; 2],
b: TestEnum,
c: &[TestEnum; 2],
d: &[i64; 2],
) -> Self {
let mut s = Self([0; 32]);
s.set_a(a);
s.set_b(b);
s.set_c(c);
s.set_d(d);
s
}
pub fn a(&'a self) -> ::flatbuffers::Array<'a, i32, 2> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_a(&mut self, items: &[i32; 2]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn b(&self) -> TestEnum {
let mut mem = ::core::mem::MaybeUninit::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[8..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
::core::mem::size_of::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_b(&mut self, x: TestEnum) {
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
self.0[8..].as_mut_ptr(),
::core::mem::size_of::<<TestEnum as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
pub fn c(&'a self) -> ::flatbuffers::Array<'a, TestEnum, 2> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 9) }
}
pub fn set_c(&mut self, x: &[TestEnum; 2]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe {
::core::ptr::copy(
x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(9),
2,
);
}
}
pub fn d(&'a self) -> ::flatbuffers::Array<'a, i64, 2> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 16) }
}
pub fn set_d(&mut self, items: &[i64; 2]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 16, items) };
}
pub fn unpack(&self) -> NestedStructT {
NestedStructT {
a: self.a().into(),
b: self.b(),
c: self.c().into(),
d: self.d().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct NestedStructT {
pub a: [i32; 2],
pub b: TestEnum,
pub c: [TestEnum; 2],
pub d: [i64; 2],
}
impl Default for NestedStructT {
fn default() -> Self {
Self {
a: [0; 2],
b: TestEnum::A,
c: ::flatbuffers::array_init(|_| Default::default()),
d: [0; 2],
}
}
}
impl NestedStructT {
pub fn pack(&self) -> NestedStruct {
NestedStruct::new(
&self.a,
self.b,
&self.c,
&self.d,
)
}
}
// struct ArrayStruct, aligned to 8
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct ArrayStruct(pub [u8; 160]);
impl Default for ArrayStruct {
fn default() -> Self {
Self([0; 160])
}
}
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())
.field("c", &self.c())
.field("d", &self.d())
.field("e", &self.e())
.field("f", &self.f())
.finish()
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for ArrayStruct {}
impl<'a> ::flatbuffers::Follow<'a> for ArrayStruct {
type Inner = &'a ArrayStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a ArrayStruct>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a ArrayStruct {
type Inner = &'a ArrayStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<ArrayStruct>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for ArrayStruct {
type Output = ArrayStruct;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(8)
}
}
impl<'a> ::flatbuffers::Verifiable for ArrayStruct {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
impl<'a> ArrayStruct {
#[allow(clippy::too_many_arguments)]
pub fn new(
a: f32,
b: &[i32; 15],
c: i8,
d: &[NestedStruct; 2],
e: i32,
f: &[i64; 2],
) -> Self {
let mut s = Self([0; 160]);
s.set_a(a);
s.set_b(b);
s.set_c(c);
s.set_d(d);
s.set_e(e);
s.set_f(f);
s
}
pub fn a(&self) -> f32 {
let mut mem = ::core::mem::MaybeUninit::<<f32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[0..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_a(&mut self, x: f32) {
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
self.0[0..].as_mut_ptr(),
::core::mem::size_of::<<f32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
pub fn b(&'a self) -> ::flatbuffers::Array<'a, i32, 15> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 4) }
}
pub fn set_b(&mut self, items: &[i32; 15]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 4, items) };
}
pub fn c(&self) -> i8 {
let mut mem = ::core::mem::MaybeUninit::<<i8 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[64..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_c(&mut self, x: i8) {
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
self.0[64..].as_mut_ptr(),
::core::mem::size_of::<<i8 as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
pub fn d(&'a self) -> ::flatbuffers::Array<'a, NestedStruct, 2> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 72) }
}
pub fn set_d(&mut self, x: &[NestedStruct; 2]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe {
::core::ptr::copy(
x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(72),
64,
);
}
}
pub fn e(&self) -> i32 {
let mut mem = ::core::mem::MaybeUninit::<<i32 as ::flatbuffers::EndianScalar>::Scalar>::uninit();
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
::flatbuffers::EndianScalar::from_little_endian(unsafe {
::core::ptr::copy_nonoverlapping(
self.0[136..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
mem.assume_init()
})
}
pub fn set_e(&mut self, x: i32) {
let x_le = ::flatbuffers::EndianScalar::to_little_endian(x);
// Safety:
// Created from a valid Table for this object
// Which contains a valid value in this slot
unsafe {
::core::ptr::copy_nonoverlapping(
&x_le as *const _ as *const u8,
self.0[136..].as_mut_ptr(),
::core::mem::size_of::<<i32 as ::flatbuffers::EndianScalar>::Scalar>(),
);
}
}
pub fn f(&'a self) -> ::flatbuffers::Array<'a, i64, 2> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 144) }
}
pub fn set_f(&mut self, items: &[i64; 2]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 144, items) };
}
pub fn unpack(&self) -> ArrayStructT {
ArrayStructT {
a: self.a(),
b: self.b().into(),
c: self.c(),
d: { let d = self.d(); ::flatbuffers::array_init(|i| d.get(i).unpack()) },
e: self.e(),
f: self.f().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct ArrayStructT {
pub a: f32,
pub b: [i32; 15],
pub c: i8,
pub d: [NestedStructT; 2],
pub e: i32,
pub f: [i64; 2],
}
impl Default for ArrayStructT {
fn default() -> Self {
Self {
a: 0.0,
b: [0; 15],
c: 0,
d: ::flatbuffers::array_init(|_| Default::default()),
e: 0,
f: [0; 2],
}
}
}
impl ArrayStructT {
pub fn pack(&self) -> ArrayStruct {
ArrayStruct::new(
self.a,
&self.b,
self.c,
&::flatbuffers::array_init(|i| self.d[i].pack()),
self.e,
&self.f,
)
}
}
// struct LargeArrayStruct, aligned to 4
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct LargeArrayStruct(pub [u8; 384]);
impl Default for LargeArrayStruct {
fn default() -> Self {
Self([0; 384])
}
}
impl ::core::fmt::Debug for LargeArrayStruct {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("LargeArrayStruct")
.field("d", &self.d())
.field("e", &self.e())
.field("f", &self.f())
.finish()
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for LargeArrayStruct {}
impl<'a> ::flatbuffers::Follow<'a> for LargeArrayStruct {
type Inner = &'a LargeArrayStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a LargeArrayStruct>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a LargeArrayStruct {
type Inner = &'a LargeArrayStruct;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<LargeArrayStruct>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for LargeArrayStruct {
type Output = LargeArrayStruct;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const LargeArrayStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(4)
}
}
impl<'a> ::flatbuffers::Verifiable for LargeArrayStruct {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.in_buffer::<Self>(pos)
}
}
impl<'a> LargeArrayStruct {
#[allow(clippy::too_many_arguments)]
pub fn new(
d: &[u8; 64],
e: &[f32; 64],
f: &[bool; 64],
) -> Self {
let mut s = Self([0; 384]);
s.set_d(d);
s.set_e(e);
s.set_f(f);
s
}
pub fn d(&'a self) -> ::flatbuffers::Array<'a, u8, 64> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_d(&mut self, items: &[u8; 64]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn e(&'a self) -> ::flatbuffers::Array<'a, f32, 64> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 64) }
}
pub fn set_e(&mut self, items: &[f32; 64]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 64, items) };
}
pub fn f(&'a self) -> ::flatbuffers::Array<'a, bool, 64> {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
use ::flatbuffers::Follow;
unsafe { ::flatbuffers::Array::follow(&self.0, 320) }
}
pub fn set_f(&mut self, items: &[bool; 64]) {
// Safety:
// Created from a valid Table for this object
// Which contains a valid array in this slot
unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 320, items) };
}
pub fn unpack(&self) -> LargeArrayStructT {
LargeArrayStructT {
d: self.d().into(),
e: self.e().into(),
f: self.f().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct LargeArrayStructT {
pub d: [u8; 64],
pub e: [f32; 64],
pub f: [bool; 64],
}
impl Default for LargeArrayStructT {
fn default() -> Self {
Self {
d: [0; 64],
e: [0.0; 64],
f: [false; 64],
}
}
}
impl LargeArrayStructT {
pub fn pack(&self) -> LargeArrayStruct {
LargeArrayStruct::new(
&self.d,
&self.e,
&self.f,
)
}
}
pub enum ArrayTableOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ArrayTable<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for ArrayTable<'a> {
type Inner = ArrayTable<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> ArrayTable<'a> {
pub const VT_A: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ArrayTable { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ArrayTableArgs<'args>
) -> ::flatbuffers::WIPOffset<ArrayTable<'bldr>> {
let mut builder = ArrayTableBuilder::new(_fbb);
if let Some(x) = args.a { builder.add_a(x); }
builder.finish()
}
pub fn unpack(&self) -> ArrayTableT {
let a = self.a().map(|x| {
x.unpack()
});
ArrayTableT {
a,
}
}
#[inline]
pub fn a(&self) -> Option<&'a ArrayStruct> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<ArrayStruct>(ArrayTable::VT_A, None)}
}
}
impl ::flatbuffers::Verifiable for ArrayTable<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier, pos: usize
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<ArrayStruct>("a", Self::VT_A, false)?
.finish();
Ok(())
}
}
pub struct ArrayTableArgs<'a> {
pub a: Option<&'a ArrayStruct>,
}
impl<'a> Default for ArrayTableArgs<'a> {
#[inline]
fn default() -> Self {
ArrayTableArgs {
a: None,
}
}
}
pub struct ArrayTableBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ArrayTableBuilder<'a, 'b, A> {
#[inline]
pub fn add_a(&mut self, a: &ArrayStruct) {
self.fbb_.push_slot_always::<&ArrayStruct>(ArrayTable::VT_A, a);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayTableBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ArrayTableBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<ArrayTable<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
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()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct ArrayTableT {
pub a: Option<ArrayStructT>,
}
impl Default for ArrayTableT {
fn default() -> Self {
Self {
a: None,
}
}
}
impl ArrayTableT {
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
) -> ::flatbuffers::WIPOffset<ArrayTable<'b>> {
let a_tmp = self.a.as_ref().map(|x| x.pack());
let a = a_tmp.as_ref();
ArrayTable::create(_fbb, &ArrayTableArgs{
a,
})
}
}
#[inline]
/// Verifies that a buffer of bytes contains a `ArrayTable`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`.
pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<ArrayTable>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `ArrayTable` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_array_table_unchecked`.
pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<ArrayTable>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `ArrayTable` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`.
pub fn root_as_array_table_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<ArrayTable<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `ArrayTable` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_array_table_unchecked`.
pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<ArrayTable<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<ArrayTable<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `ArrayTable`.
pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
unsafe { ::flatbuffers::root_unchecked::<ArrayTable>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`.
pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) }
}
pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT";
#[inline]
pub fn array_table_buffer_has_identifier(buf: &[u8]) -> bool {
::flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, false)
}
#[inline]
pub fn array_table_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
::flatbuffers::buffer_has_identifier(buf, ARRAY_TABLE_IDENTIFIER, true)
}
pub const ARRAY_TABLE_EXTENSION: &str = "mon";
#[inline]
pub fn finish_array_table_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<ArrayTable<'a>>) {
fbb.finish(root, Some(ARRAY_TABLE_IDENTIFIER));
}
#[inline]
pub fn finish_size_prefixed_array_table_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<ArrayTable<'a>>) {
fbb.finish_size_prefixed(root, Some(ARRAY_TABLE_IDENTIFIER));
}
} // pub mod Example
} // pub mod MyGame