mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 11:48:05 +00:00
Port FlatBuffers to Rust (#4898)
This is a port of FlatBuffers to Rust. It provides code generation and a runtime library derived from the C++ implementation. It utilizes the Rust type system to provide safe and fast traversal of FlatBuffers data. There are 188 tests, including many fuzz tests of roundtrips for various serialization scenarios. Initial benchmarks indicate that the canonical example payload can be written in ~700ns, and traversed in ~100ns. Rustaceans may be interested in the Follow, Push, and SafeSliceAccess traits. These traits lift traversals, reads, writes, and slice accesses into the type system, providing abstraction with no runtime penalty.
This commit is contained in:
224
tests/namespace_test/namespace_test1_generated.rs
Normal file
224
tests/namespace_test/namespace_test1_generated.rs
Normal file
@@ -0,0 +1,224 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
pub mod namespace_a {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
pub mod namespace_b {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[repr(i8)]
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub enum EnumInNestedNS {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
|
||||
const ENUM_MIN_ENUM_IN_NESTED_N_S: i8 = 0;
|
||||
const ENUM_MAX_ENUM_IN_NESTED_N_S: i8 = 2;
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::read_scalar_at::<Self>(buf, loc)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for EnumInNestedNS {
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> Self {
|
||||
let n = i8::to_le(self as i8);
|
||||
let p = &n as *const i8 as *const EnumInNestedNS;
|
||||
unsafe { *p }
|
||||
}
|
||||
#[inline]
|
||||
fn from_little_endian(self) -> Self {
|
||||
let n = i8::from_le(self as i8);
|
||||
let p = &n as *const i8 as *const EnumInNestedNS;
|
||||
unsafe { *p }
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for EnumInNestedNS {
|
||||
type Output = EnumInNestedNS;
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
flatbuffers::emplace_scalar::<EnumInNestedNS>(dst, *self);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
const ENUM_VALUES_ENUM_IN_NESTED_N_S:[EnumInNestedNS; 3] = [
|
||||
EnumInNestedNS::A,
|
||||
EnumInNestedNS::B,
|
||||
EnumInNestedNS::C
|
||||
];
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
const ENUM_NAMES_ENUM_IN_NESTED_N_S:[&'static str; 3] = [
|
||||
"A",
|
||||
"B",
|
||||
"C"
|
||||
];
|
||||
|
||||
pub fn enum_name_enum_in_nested_n_s(e: EnumInNestedNS) -> &'static str {
|
||||
let index: usize = e as usize;
|
||||
ENUM_NAMES_ENUM_IN_NESTED_N_S[index]
|
||||
}
|
||||
|
||||
// struct StructInNestedNS, aligned to 4
|
||||
#[repr(C, align(4))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct StructInNestedNS {
|
||||
a_: i32,
|
||||
b_: i32,
|
||||
} // pub struct StructInNestedNS
|
||||
impl flatbuffers::SafeSliceAccess for StructInNestedNS {}
|
||||
impl<'a> flatbuffers::Follow<'a> for StructInNestedNS {
|
||||
type Inner = &'a StructInNestedNS;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a StructInNestedNS>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a StructInNestedNS {
|
||||
type Inner = &'a StructInNestedNS;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for StructInNestedNS {
|
||||
type Output = 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())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for &'b StructInNestedNS {
|
||||
type Output = 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())
|
||||
};
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl StructInNestedNS {
|
||||
pub fn new<'a>(_a: i32, _b: i32) -> Self {
|
||||
StructInNestedNS {
|
||||
a_: _a.to_little_endian(),
|
||||
b_: _b.to_little_endian(),
|
||||
|
||||
}
|
||||
}
|
||||
pub fn a<'a>(&'a self) -> i32 {
|
||||
self.a_.from_little_endian()
|
||||
}
|
||||
pub fn b<'a>(&'a self) -> i32 {
|
||||
self.b_.from_little_endian()
|
||||
}
|
||||
}
|
||||
|
||||
pub enum TableInNestedNSOffset {}
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
||||
pub struct TableInNestedNS<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableInNestedNS<'a> {
|
||||
type Inner = TableInNestedNS<'a>;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self {
|
||||
_tab: flatbuffers::Table { buf: buf, loc: loc },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableInNestedNS<'a> {
|
||||
#[inline]
|
||||
pub 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>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
|
||||
args: &'args TableInNestedNSArgs) -> flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
|
||||
let mut builder = TableInNestedNSBuilder::new(_fbb);
|
||||
builder.add_foo(args.foo);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub const VT_FOO: flatbuffers::VOffsetT = 4;
|
||||
|
||||
#[inline]
|
||||
pub fn foo(&'a self) -> i32 {
|
||||
self._tab.get::<i32>(TableInNestedNS::VT_FOO, Some(0)).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInNestedNSArgs {
|
||||
pub foo: i32,
|
||||
}
|
||||
impl<'a> Default for TableInNestedNSArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableInNestedNSArgs {
|
||||
foo: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct TableInNestedNSBuilder<'a: 'b, 'b> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b> TableInNestedNSBuilder<'a, 'b> {
|
||||
#[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>) -> TableInNestedNSBuilder<'a, 'b> {
|
||||
let start = _fbb.start_table();
|
||||
TableInNestedNSBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableInNestedNS<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
} // pub mod NamespaceB
|
||||
} // pub mod NamespaceA
|
||||
|
||||
291
tests/namespace_test/namespace_test2_generated.rs
Normal file
291
tests/namespace_test/namespace_test2_generated.rs
Normal file
@@ -0,0 +1,291 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
pub mod namespace_a {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
pub enum TableInFirstNSOffset {}
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
||||
pub struct TableInFirstNS<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableInFirstNS<'a> {
|
||||
type Inner = TableInFirstNS<'a>;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self {
|
||||
_tab: flatbuffers::Table { buf: buf, loc: loc },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableInFirstNS<'a> {
|
||||
#[inline]
|
||||
pub 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>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
|
||||
args: &'args TableInFirstNSArgs) -> flatbuffers::WIPOffset<TableInFirstNS<'bldr>> {
|
||||
let mut builder = TableInFirstNSBuilder::new(_fbb);
|
||||
if let Some(x) = args.foo_struct { builder.add_foo_struct(x); }
|
||||
if let Some(x) = args.foo_table { builder.add_foo_table(x); }
|
||||
builder.add_foo_enum(args.foo_enum);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub const VT_FOO_TABLE: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_FOO_ENUM: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_FOO_STRUCT: flatbuffers::VOffsetT = 8;
|
||||
|
||||
#[inline]
|
||||
pub fn foo_table(&'a self) -> Option<namespace_b::TableInNestedNS<'a>> {
|
||||
self._tab.get::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS<'a>>>(TableInFirstNS::VT_FOO_TABLE, None)
|
||||
}
|
||||
#[inline]
|
||||
pub fn foo_enum(&'a self) -> namespace_b::EnumInNestedNS {
|
||||
self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()
|
||||
}
|
||||
#[inline]
|
||||
pub fn foo_struct(&'a self) -> Option<&'a namespace_b::StructInNestedNS> {
|
||||
self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInFirstNSArgs {
|
||||
pub foo_table: Option<flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a >>>,
|
||||
pub foo_enum: namespace_b::EnumInNestedNS,
|
||||
pub foo_struct: Option<&'a namespace_b::StructInNestedNS>,
|
||||
}
|
||||
impl<'a> Default for TableInFirstNSArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableInFirstNSArgs {
|
||||
foo_table: None,
|
||||
foo_enum: namespace_b::EnumInNestedNS::A,
|
||||
foo_struct: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct TableInFirstNSBuilder<'a: 'b, 'b> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b> TableInFirstNSBuilder<'a, 'b> {
|
||||
#[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_struct(&mut self, foo_struct: &'b 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>) -> TableInFirstNSBuilder<'a, 'b> {
|
||||
let start = _fbb.start_table();
|
||||
TableInFirstNSBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableInFirstNS<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
pub enum SecondTableInAOffset {}
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
||||
pub struct SecondTableInA<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for SecondTableInA<'a> {
|
||||
type Inner = SecondTableInA<'a>;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self {
|
||||
_tab: flatbuffers::Table { buf: buf, loc: loc },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> SecondTableInA<'a> {
|
||||
#[inline]
|
||||
pub 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>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
|
||||
args: &'args SecondTableInAArgs) -> flatbuffers::WIPOffset<SecondTableInA<'bldr>> {
|
||||
let mut builder = SecondTableInABuilder::new(_fbb);
|
||||
if let Some(x) = args.refer_to_c { builder.add_refer_to_c(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub const VT_REFER_TO_C: flatbuffers::VOffsetT = 4;
|
||||
|
||||
#[inline]
|
||||
pub fn refer_to_c(&'a self) -> Option<super::namespace_c::TableInC<'a>> {
|
||||
self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC<'a>>>(SecondTableInA::VT_REFER_TO_C, None)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SecondTableInAArgs {
|
||||
pub refer_to_c: Option<flatbuffers::WIPOffset<super::namespace_c::TableInC<'a >>>,
|
||||
}
|
||||
impl<'a> Default for SecondTableInAArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
SecondTableInAArgs {
|
||||
refer_to_c: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct SecondTableInABuilder<'a: 'b, 'b> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b> SecondTableInABuilder<'a, 'b> {
|
||||
#[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>) -> SecondTableInABuilder<'a, 'b> {
|
||||
let start = _fbb.start_table();
|
||||
SecondTableInABuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<SecondTableInA<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
} // pub mod NamespaceA
|
||||
|
||||
pub mod namespace_c {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
pub enum TableInCOffset {}
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
||||
pub struct TableInC<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableInC<'a> {
|
||||
type Inner = TableInC<'a>;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self {
|
||||
_tab: flatbuffers::Table { buf: buf, loc: loc },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableInC<'a> {
|
||||
#[inline]
|
||||
pub 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>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
|
||||
args: &'args TableInCArgs) -> flatbuffers::WIPOffset<TableInC<'bldr>> {
|
||||
let mut builder = TableInCBuilder::new(_fbb);
|
||||
if let Some(x) = args.refer_to_a2 { builder.add_refer_to_a2(x); }
|
||||
if let Some(x) = args.refer_to_a1 { builder.add_refer_to_a1(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub const VT_REFER_TO_A1: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_REFER_TO_A2: flatbuffers::VOffsetT = 6;
|
||||
|
||||
#[inline]
|
||||
pub fn refer_to_a1(&'a self) -> Option<super::namespace_a::TableInFirstNS<'a>> {
|
||||
self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS<'a>>>(TableInC::VT_REFER_TO_A1, None)
|
||||
}
|
||||
#[inline]
|
||||
pub fn refer_to_a2(&'a self) -> Option<super::namespace_a::SecondTableInA<'a>> {
|
||||
self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA<'a>>>(TableInC::VT_REFER_TO_A2, None)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInCArgs {
|
||||
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 {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableInCArgs {
|
||||
refer_to_a1: None,
|
||||
refer_to_a2: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct TableInCBuilder<'a: 'b, 'b> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b> TableInCBuilder<'a, 'b> {
|
||||
#[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>) -> TableInCBuilder<'a, 'b> {
|
||||
let start = _fbb.start_table();
|
||||
TableInCBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableInC<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
} // pub mod NamespaceC
|
||||
|
||||
Reference in New Issue
Block a user