mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-14 16:36:55 +00:00
Fixes unused imports in Rust code generator (#8828)
* Fixes unused imports in Rust code generator * Regenerates generated schemas
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
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.")]
|
||||
pub const ENUM_MIN_ABC: i32 = 0;
|
||||
@@ -47,8 +40,8 @@ impl ABC {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for ABC {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::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 {
|
||||
@@ -56,24 +49,24 @@ impl core::fmt::Debug for ABC {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for ABC {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for ABC {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { flatbuffers::read_scalar_at::<i32>(buf, loc) };
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for ABC {
|
||||
impl ::flatbuffers::Push for ABC {
|
||||
type Output = ABC;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { flatbuffers::emplace_scalar::<i32>(dst, self.0); }
|
||||
unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for ABC {
|
||||
impl ::flatbuffers::EndianScalar for ABC {
|
||||
type Scalar = i32;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i32 {
|
||||
@@ -87,14 +80,13 @@ impl flatbuffers::EndianScalar for ABC {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for ABC {
|
||||
impl<'a> ::flatbuffers::Verifiable for ABC {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
i32::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for ABC {}
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for ABC {}
|
||||
|
||||
@@ -1,48 +1,41 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
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 {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct KeywordsInTable<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for KeywordsInTable<'a> {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for KeywordsInTable<'a> {
|
||||
type Inner = KeywordsInTable<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> KeywordsInTable<'a> {
|
||||
pub const VT_IS: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_PRIVATE: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_TYPE_: flatbuffers::VOffsetT = 8;
|
||||
pub const VT_DEFAULT: flatbuffers::VOffsetT = 10;
|
||||
pub const VT_IS: ::flatbuffers::VOffsetT = 4;
|
||||
pub const VT_PRIVATE: ::flatbuffers::VOffsetT = 6;
|
||||
pub const VT_TYPE_: ::flatbuffers::VOffsetT = 8;
|
||||
pub const VT_DEFAULT: ::flatbuffers::VOffsetT = 10;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"KeywordTest.KeywordsInTable"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
KeywordsInTable { _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>,
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args KeywordsInTableArgs
|
||||
) -> flatbuffers::WIPOffset<KeywordsInTable<'bldr>> {
|
||||
) -> ::flatbuffers::WIPOffset<KeywordsInTable<'bldr>> {
|
||||
let mut builder = KeywordsInTableBuilder::new(_fbb);
|
||||
builder.add_type_(args.type_);
|
||||
builder.add_private(args.private);
|
||||
@@ -94,12 +87,11 @@ impl<'a> KeywordsInTable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for KeywordsInTable<'_> {
|
||||
impl ::flatbuffers::Verifiable for KeywordsInTable<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<ABC>("is", Self::VT_IS, false)?
|
||||
.visit_field::<public>("private", Self::VT_PRIVATE, false)?
|
||||
@@ -127,11 +119,11 @@ impl<'a> Default for KeywordsInTableArgs {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct KeywordsInTableBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
pub struct KeywordsInTableBuilder<'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> KeywordsInTableBuilder<'a, 'b, A> {
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_is(&mut self, is: ABC) {
|
||||
self.fbb_.push_slot::<ABC>(KeywordsInTable::VT_IS, is, ABC::void);
|
||||
@@ -149,7 +141,7 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b,
|
||||
self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> {
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> KeywordsInTableBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
KeywordsInTableBuilder {
|
||||
fbb_: _fbb,
|
||||
@@ -157,14 +149,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> KeywordsInTableBuilder<'a, 'b,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<KeywordsInTable<'a>> {
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<KeywordsInTable<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for KeywordsInTable<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::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());
|
||||
@@ -192,10 +184,10 @@ impl Default for KeywordsInTableT {
|
||||
}
|
||||
}
|
||||
impl KeywordsInTableT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<KeywordsInTable<'b>> {
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<KeywordsInTable<'b>> {
|
||||
let is = self.is;
|
||||
let private = self.private;
|
||||
let type_ = self.type_;
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
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.")]
|
||||
pub const ENUM_MIN_KEYWORDS_IN_UNION: u8 = 0;
|
||||
@@ -47,8 +40,8 @@ impl KeywordsInUnion {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for KeywordsInUnion {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::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 {
|
||||
@@ -56,24 +49,24 @@ impl core::fmt::Debug for KeywordsInUnion {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for KeywordsInUnion {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for KeywordsInUnion {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<u8>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for KeywordsInUnion {
|
||||
impl ::flatbuffers::Push for KeywordsInUnion {
|
||||
type Output = KeywordsInUnion;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
|
||||
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for KeywordsInUnion {
|
||||
impl ::flatbuffers::EndianScalar for KeywordsInUnion {
|
||||
type Scalar = u8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
@@ -87,17 +80,16 @@ impl flatbuffers::EndianScalar for KeywordsInUnion {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for KeywordsInUnion {
|
||||
impl<'a> ::flatbuffers::Verifiable for KeywordsInUnion {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
u8::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {}
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for KeywordsInUnion {}
|
||||
pub struct KeywordsInUnionUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -105,8 +97,8 @@ pub struct KeywordsInUnionUnionTableOffset {}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum KeywordsInUnionT {
|
||||
NONE,
|
||||
Static_(Box<KeywordsInTableT>),
|
||||
Internal(Box<KeywordsInTableT>),
|
||||
Static_(alloc::boxed::Box<KeywordsInTableT>),
|
||||
Internal(alloc::boxed::Box<KeywordsInTableT>),
|
||||
}
|
||||
impl Default for KeywordsInUnionT {
|
||||
fn default() -> Self {
|
||||
@@ -121,7 +113,7 @@ impl KeywordsInUnionT {
|
||||
Self::Internal(_) => KeywordsInUnion::internal,
|
||||
}
|
||||
}
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
|
||||
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::Static_(v) => Some(v.pack(fbb).as_union_value()),
|
||||
@@ -129,9 +121,9 @@ 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>> {
|
||||
pub fn take_static_(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
|
||||
if let Self::Static_(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
let v = ::core::mem::replace(self, Self::NONE);
|
||||
if let Self::Static_(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
@@ -150,9 +142,9 @@ impl KeywordsInUnionT {
|
||||
if let Self::Static_(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
|
||||
pub fn take_internal(&mut self) -> Option<Box<KeywordsInTableT>> {
|
||||
pub fn take_internal(&mut self) -> Option<alloc::boxed::Box<KeywordsInTableT>> {
|
||||
if let Self::Internal(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
let v = ::core::mem::replace(self, Self::NONE);
|
||||
if let Self::Internal(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
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.")]
|
||||
pub const ENUM_MIN_PUBLIC: i32 = 0;
|
||||
@@ -39,8 +32,8 @@ impl public {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for public {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::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 {
|
||||
@@ -48,24 +41,24 @@ impl core::fmt::Debug for public {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for public {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for public {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = unsafe { flatbuffers::read_scalar_at::<i32>(buf, loc) };
|
||||
let b = unsafe { ::flatbuffers::read_scalar_at::<i32>(buf, loc) };
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for public {
|
||||
impl ::flatbuffers::Push for public {
|
||||
type Output = public;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
unsafe { flatbuffers::emplace_scalar::<i32>(dst, self.0); }
|
||||
unsafe { ::flatbuffers::emplace_scalar::<i32>(dst, self.0) };
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for public {
|
||||
impl ::flatbuffers::EndianScalar for public {
|
||||
type Scalar = i32;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i32 {
|
||||
@@ -79,14 +72,13 @@ impl flatbuffers::EndianScalar for public {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for public {
|
||||
impl<'a> ::flatbuffers::Verifiable for public {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
i32::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for public {}
|
||||
impl ::flatbuffers::SimpleToVerifyInSlice for public {}
|
||||
|
||||
@@ -1,46 +1,39 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
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 Table2Offset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct Table2<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
pub _tab: ::flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for Table2<'a> {
|
||||
impl<'a> ::flatbuffers::Follow<'a> for Table2<'a> {
|
||||
type Inner = Table2<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
|
||||
Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Table2<'a> {
|
||||
pub const VT_TYPE_TYPE: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_TYPE_: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_TYPE_TYPE: ::flatbuffers::VOffsetT = 4;
|
||||
pub const VT_TYPE_: ::flatbuffers::VOffsetT = 6;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"KeywordTest.Table2"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
||||
Table2 { _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>,
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args Table2Args
|
||||
) -> flatbuffers::WIPOffset<Table2<'bldr>> {
|
||||
) -> ::flatbuffers::WIPOffset<Table2<'bldr>> {
|
||||
let mut builder = Table2Builder::new(_fbb);
|
||||
if let Some(x) = args.type_ { builder.add_type_(x); }
|
||||
builder.add_type_type(args.type_type);
|
||||
@@ -50,12 +43,12 @@ impl<'a> Table2<'a> {
|
||||
pub fn unpack(&self) -> Table2T {
|
||||
let type_ = match self.type_type() {
|
||||
KeywordsInUnion::NONE => KeywordsInUnionT::NONE,
|
||||
KeywordsInUnion::static_ => KeywordsInUnionT::Static_(Box::new(
|
||||
KeywordsInUnion::static_ => KeywordsInUnionT::Static_(alloc::boxed::Box::new(
|
||||
self.type__as_static_()
|
||||
.expect("Invalid union table, expected `KeywordsInUnion::static_`.")
|
||||
.unpack()
|
||||
)),
|
||||
KeywordsInUnion::internal => KeywordsInUnionT::Internal(Box::new(
|
||||
KeywordsInUnion::internal => KeywordsInUnionT::Internal(alloc::boxed::Box::new(
|
||||
self.type__as_internal()
|
||||
.expect("Invalid union table, expected `KeywordsInUnion::internal`.")
|
||||
.unpack()
|
||||
@@ -75,11 +68,11 @@ impl<'a> Table2<'a> {
|
||||
unsafe { self._tab.get::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, Some(KeywordsInUnion::NONE)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn type_(&self) -> Option<flatbuffers::Table<'a>> {
|
||||
pub fn type_(&self) -> Option<::flatbuffers::Table<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)}
|
||||
unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(Table2::VT_TYPE_, None)}
|
||||
}
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
@@ -113,17 +106,16 @@ impl<'a> Table2<'a> {
|
||||
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for Table2<'_> {
|
||||
impl ::flatbuffers::Verifiable for Table2<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v: &mut ::flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
||||
v.visit_table(pos)?
|
||||
.visit_union::<KeywordsInUnion, _>("type_type", Self::VT_TYPE_TYPE, "type_", Self::VT_TYPE_, false, |key, v, pos| {
|
||||
match key {
|
||||
KeywordsInUnion::static_ => v.verify_union_variant::<flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::static_", pos),
|
||||
KeywordsInUnion::internal => v.verify_union_variant::<flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::internal", pos),
|
||||
KeywordsInUnion::static_ => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::static_", pos),
|
||||
KeywordsInUnion::internal => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<KeywordsInTable>>("KeywordsInUnion::internal", pos),
|
||||
_ => Ok(()),
|
||||
}
|
||||
})?
|
||||
@@ -133,7 +125,7 @@ impl flatbuffers::Verifiable for Table2<'_> {
|
||||
}
|
||||
pub struct Table2Args {
|
||||
pub type_type: KeywordsInUnion,
|
||||
pub type_: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
|
||||
pub type_: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
|
||||
}
|
||||
impl<'a> Default for Table2Args {
|
||||
#[inline]
|
||||
@@ -145,21 +137,21 @@ impl<'a> Default for Table2Args {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Table2Builder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
pub struct Table2Builder<'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> Table2Builder<'a, 'b, A> {
|
||||
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_type_type(&mut self, type_type: KeywordsInUnion) {
|
||||
self.fbb_.push_slot::<KeywordsInUnion>(Table2::VT_TYPE_TYPE, type_type, KeywordsInUnion::NONE);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_);
|
||||
pub fn add_type_(&mut self, type_: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>) {
|
||||
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(Table2::VT_TYPE_, type_);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> {
|
||||
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> Table2Builder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
Table2Builder {
|
||||
fbb_: _fbb,
|
||||
@@ -167,14 +159,14 @@ impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> Table2Builder<'a, 'b, A> {
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<Table2<'a>> {
|
||||
pub fn finish(self) -> ::flatbuffers::WIPOffset<Table2<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
::flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Table2<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
impl ::core::fmt::Debug for Table2<'_> {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
||||
let mut ds = f.debug_struct("Table2");
|
||||
ds.field("type_type", &self.type_type());
|
||||
match self.type_type() {
|
||||
@@ -213,10 +205,10 @@ impl Default for Table2T {
|
||||
}
|
||||
}
|
||||
impl Table2T {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
pub fn pack<'b, A: ::flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<Table2<'b>> {
|
||||
_fbb: &mut ::flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> ::flatbuffers::WIPOffset<Table2<'b>> {
|
||||
let type_type = self.type_.keywords_in_union_type();
|
||||
let type_ = self.type_.pack(_fbb);
|
||||
Table2::create(_fbb, &Table2Args{
|
||||
|
||||
Reference in New Issue
Block a user