mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 06:27:32 +00:00
Generate better formatted Rust code (#8919)
* Cleans up Rust formatting * Regenerates generated schemas
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_ENUM_IN_NESTED_NS: 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_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [
|
||||
@@ -17,6 +20,7 @@ pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct EnumInNestedNS(pub i8);
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl EnumInNestedNS {
|
||||
pub const A: Self = Self(0);
|
||||
@@ -30,6 +34,7 @@ impl EnumInNestedNS {
|
||||
Self::B,
|
||||
Self::C,
|
||||
];
|
||||
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
@@ -40,6 +45,7 @@ impl EnumInNestedNS {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for EnumInNestedNS {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
@@ -49,8 +55,10 @@ impl ::core::fmt::Debug for EnumInNestedNS {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for EnumInNestedNS {
|
||||
type Inner = Self;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<i8>(buf, loc) };
|
||||
@@ -60,6 +68,7 @@ impl<'a> ::flatbuffers::Follow<'a> for EnumInNestedNS {
|
||||
|
||||
impl ::flatbuffers::Push for EnumInNestedNS {
|
||||
type Output = EnumInNestedNS;
|
||||
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { ::flatbuffers::emplace_scalar::<i8>(dst, self.0) };
|
||||
@@ -68,10 +77,12 @@ impl ::flatbuffers::Push for EnumInNestedNS {
|
||||
|
||||
impl ::flatbuffers::EndianScalar for EnumInNestedNS {
|
||||
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 {
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
|
||||
// struct StructInNestedNS, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct StructInNestedNS(pub [u8; 8]);
|
||||
|
||||
impl Default for StructInNestedNS {
|
||||
fn default() -> Self {
|
||||
Self([0; 8])
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for StructInNestedNS {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
f.debug_struct("StructInNestedNS")
|
||||
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for StructInNestedNS {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for StructInNestedNS {
|
||||
type Inner = &'a StructInNestedNS;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { <&'a StructInNestedNS>::follow(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for &'a StructInNestedNS {
|
||||
type Inner = &'a StructInNestedNS;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
unsafe { ::flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> ::flatbuffers::Push for StructInNestedNS {
|
||||
type Output = StructInNestedNS;
|
||||
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = unsafe { ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, <Self as ::flatbuffers::Push>::size()) };
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn alignment() -> ::flatbuffers::PushAlignment {
|
||||
::flatbuffers::PushAlignment::new(4)
|
||||
@@ -144,6 +154,7 @@ pub struct StructInNestedNST {
|
||||
pub a: i32,
|
||||
pub b: i32,
|
||||
}
|
||||
|
||||
impl StructInNestedNST {
|
||||
pub fn pack(&self) -> StructInNestedNS {
|
||||
StructInNestedNS::new(
|
||||
@@ -152,4 +163,3 @@ impl StructInNestedNST {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum TableInNestedNSOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum TableInNestedNSOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct TableInNestedNS<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableInNestedNS<'a> {
|
||||
type Inner = TableInNestedNS<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -28,6 +30,7 @@ impl<'a> TableInNestedNS<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableInNestedNS { _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>,
|
||||
@@ -65,9 +68,11 @@ impl ::flatbuffers::Verifiable for TableInNestedNS<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInNestedNSArgs {
|
||||
pub foo: i32,
|
||||
}
|
||||
|
||||
impl<'a> Default for TableInNestedNSArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -81,11 +86,13 @@ pub struct TableInNestedNSBuilder<'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> TableInNestedNSBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_foo(&mut self, foo: i32) {
|
||||
self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInNestedNSBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
@@ -94,6 +101,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInNestedNS<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -108,11 +116,13 @@ impl ::core::fmt::Debug for TableInNestedNS<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInNestedNST {
|
||||
pub foo: i32,
|
||||
}
|
||||
|
||||
impl Default for TableInNestedNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -120,6 +130,7 @@ impl Default for TableInNestedNST {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TableInNestedNST {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0;
|
||||
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_UNION_IN_NESTED_NS: u8 = 1;
|
||||
|
||||
#[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_UNION_IN_NESTED_NS: [UnionInNestedNS; 2] = [
|
||||
@@ -16,6 +19,7 @@ pub const ENUM_VALUES_UNION_IN_NESTED_NS: [UnionInNestedNS; 2] = [
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct UnionInNestedNS(pub u8);
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl UnionInNestedNS {
|
||||
pub const NONE: Self = Self(0);
|
||||
@@ -27,6 +31,7 @@ impl UnionInNestedNS {
|
||||
Self::NONE,
|
||||
Self::TableInNestedNS,
|
||||
];
|
||||
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
@@ -36,6 +41,7 @@ impl UnionInNestedNS {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Debug for UnionInNestedNS {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
@@ -45,8 +51,10 @@ impl ::core::fmt::Debug for UnionInNestedNS {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for UnionInNestedNS {
|
||||
type Inner = Self;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
@@ -56,6 +64,7 @@ impl<'a> ::flatbuffers::Follow<'a> for UnionInNestedNS {
|
||||
|
||||
impl ::flatbuffers::Push for UnionInNestedNS {
|
||||
type Output = UnionInNestedNS;
|
||||
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
|
||||
@@ -64,10 +73,12 @@ impl ::flatbuffers::Push for UnionInNestedNS {
|
||||
|
||||
impl ::flatbuffers::EndianScalar for UnionInNestedNS {
|
||||
type Scalar = u8;
|
||||
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
self.0.to_le()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: u8) -> Self {
|
||||
@@ -86,6 +97,7 @@ impl<'a> ::flatbuffers::Verifiable for UnionInNestedNS {
|
||||
}
|
||||
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {}
|
||||
|
||||
pub struct UnionInNestedNSUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -95,11 +107,13 @@ pub enum UnionInNestedNST {
|
||||
NONE,
|
||||
TableInNestedNS(alloc::boxed::Box<TableInNestedNST>),
|
||||
}
|
||||
|
||||
impl Default for UnionInNestedNST {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
|
||||
impl UnionInNestedNST {
|
||||
pub fn union_in_nested_ns_type(&self) -> UnionInNestedNS {
|
||||
match self {
|
||||
@@ -107,12 +121,14 @@ impl UnionInNestedNST {
|
||||
Self::TableInNestedNS(_) => UnionInNestedNS::TableInNestedNS,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(&self, fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>) -> Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>> {
|
||||
match self {
|
||||
Self::NONE => None,
|
||||
Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE.
|
||||
pub fn take_table_in_nested_ns(&mut self) -> Option<alloc::boxed::Box<TableInNestedNST>> {
|
||||
if let Self::TableInNestedNS(_) = self {
|
||||
@@ -126,12 +142,15 @@ impl UnionInNestedNST {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a reference to the TableInNestedNST.
|
||||
pub fn as_table_in_nested_ns(&self) -> Option<&TableInNestedNST> {
|
||||
if let Self::TableInNestedNS(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
|
||||
/// If the union variant matches, return a mutable reference to the TableInNestedNST.
|
||||
pub fn as_table_in_nested_ns_mut(&mut self) -> Option<&mut TableInNestedNST> {
|
||||
if let Self::TableInNestedNS(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum SecondTableInAOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum SecondTableInAOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct SecondTableInA<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for SecondTableInA<'a> {
|
||||
type Inner = SecondTableInA<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -28,6 +30,7 @@ impl<'a> SecondTableInA<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
SecondTableInA { _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>,
|
||||
@@ -67,9 +70,11 @@ impl ::flatbuffers::Verifiable for SecondTableInA<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SecondTableInAArgs<'a> {
|
||||
pub refer_to_c: Option<::flatbuffers::WIPOffset<super::namespace_c::TableInC<'a>>>,
|
||||
}
|
||||
|
||||
impl<'a> Default for SecondTableInAArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -83,11 +88,13 @@ pub struct SecondTableInABuilder<'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> SecondTableInABuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_refer_to_c(&mut self, refer_to_c: ::flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> SecondTableInABuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
@@ -96,6 +103,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<SecondTableInA<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -110,11 +118,13 @@ impl ::core::fmt::Debug for SecondTableInA<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct SecondTableInAT {
|
||||
pub refer_to_c: Option<alloc::boxed::Box<super::namespace_c::TableInCT>>,
|
||||
}
|
||||
|
||||
impl Default for SecondTableInAT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -122,6 +132,7 @@ impl Default for SecondTableInAT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SecondTableInAT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum TableInFirstNSOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum TableInFirstNSOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct TableInFirstNS<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableInFirstNS<'a> {
|
||||
type Inner = TableInFirstNS<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -32,6 +34,7 @@ impl<'a> TableInFirstNS<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableInFirstNS { _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>,
|
||||
@@ -78,6 +81,7 @@ impl<'a> TableInFirstNS<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, None)}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS {
|
||||
// Safety:
|
||||
@@ -85,6 +89,7 @@ impl<'a> TableInFirstNS<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn foo_union_type(&self) -> namespace_b::UnionInNestedNS {
|
||||
// Safety:
|
||||
@@ -92,6 +97,7 @@ impl<'a> TableInFirstNS<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, Some(namespace_b::UnionInNestedNS::NONE)).unwrap()}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn foo_union(&self) -> Option<::flatbuffers::Table<'a>> {
|
||||
// Safety:
|
||||
@@ -99,6 +105,7 @@ impl<'a> TableInFirstNS<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(TableInFirstNS::VT_FOO_UNION, None)}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> {
|
||||
// Safety:
|
||||
@@ -106,6 +113,7 @@ impl<'a> TableInFirstNS<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn foo_union_as_table_in_nested_ns(&self) -> Option<namespace_b::TableInNestedNS<'a>> {
|
||||
@@ -120,7 +128,6 @@ impl<'a> TableInFirstNS<'a> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl ::flatbuffers::Verifiable for TableInFirstNS<'_> {
|
||||
@@ -142,6 +149,7 @@ impl ::flatbuffers::Verifiable for TableInFirstNS<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInFirstNSArgs<'a> {
|
||||
pub foo_table: Option<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a>>>,
|
||||
pub foo_enum: namespace_b::EnumInNestedNS,
|
||||
@@ -149,6 +157,7 @@ pub struct TableInFirstNSArgs<'a> {
|
||||
pub foo_union: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
|
||||
pub foo_struct: Option<&'a namespace_b::StructInNestedNS>,
|
||||
}
|
||||
|
||||
impl<'a> Default for TableInFirstNSArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -166,27 +175,33 @@ pub struct TableInFirstNSBuilder<'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> TableInFirstNSBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_foo_table(&mut self, foo_table: ::flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) {
|
||||
self.fbb_.push_slot::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, foo_enum, namespace_b::EnumInNestedNS::A);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_foo_union_type(&mut self, foo_union_type: namespace_b::UnionInNestedNS) {
|
||||
self.fbb_.push_slot::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, foo_union_type, namespace_b::UnionInNestedNS::NONE);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_foo_union(&mut self, foo_union: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(TableInFirstNS::VT_FOO_UNION, foo_union);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_foo_struct(&mut self, foo_struct: &namespace_b::StructInNestedNS) {
|
||||
self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInFirstNSBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
@@ -195,6 +210,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInFirstNS<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -225,6 +241,7 @@ impl ::core::fmt::Debug for TableInFirstNS<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInFirstNST {
|
||||
@@ -233,6 +250,7 @@ pub struct TableInFirstNST {
|
||||
pub foo_union: namespace_b::UnionInNestedNST,
|
||||
pub foo_struct: Option<namespace_b::StructInNestedNST>,
|
||||
}
|
||||
|
||||
impl Default for TableInFirstNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -243,6 +261,7 @@ impl Default for TableInFirstNST {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TableInFirstNST {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
use super::*;
|
||||
pub enum TableInCOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub enum TableInCOffset {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub struct TableInC<'a> {
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> ::flatbuffers::Follow<'a> for TableInC<'a> {
|
||||
type Inner = TableInC<'a>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
@@ -29,6 +31,7 @@ impl<'a> TableInC<'a> {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
TableInC { _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>,
|
||||
@@ -60,6 +63,7 @@ impl<'a> TableInC<'a> {
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, None)}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> {
|
||||
// Safety:
|
||||
@@ -81,10 +85,12 @@ impl ::flatbuffers::Verifiable for TableInC<'_> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInCArgs<'a> {
|
||||
pub refer_to_a1: Option<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a>>>,
|
||||
pub refer_to_a2: Option<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a>>>,
|
||||
}
|
||||
|
||||
impl<'a> Default for TableInCArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
@@ -99,15 +105,18 @@ pub struct TableInCBuilder<'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> TableInCBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_refer_to_a1(&mut self, refer_to_a1: ::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_refer_to_a2(&mut self, refer_to_a2: ::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> TableInCBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
@@ -116,6 +125,7 @@ impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> {
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<TableInC<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
@@ -131,12 +141,14 @@ impl ::core::fmt::Debug for TableInC<'_> {
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInCT {
|
||||
pub refer_to_a1: Option<alloc::boxed::Box<super::namespace_a::TableInFirstNST>>,
|
||||
pub refer_to_a2: Option<alloc::boxed::Box<super::namespace_a::SecondTableInAT>>,
|
||||
}
|
||||
|
||||
impl Default for TableInCT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -145,6 +157,7 @@ impl Default for TableInCT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TableInCT {
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user