Home | History | Annotate | Download | only in namespace_test
      1 // automatically generated by the FlatBuffers compiler, do not modify
      2 
      3 
      4 #![allow(dead_code)]
      5 #![allow(unused_imports)]
      6 
      7 use std::mem;
      8 use std::cmp::Ordering;
      9 
     10 extern crate flatbuffers;
     11 use self::flatbuffers::EndianScalar;
     12 
     13 pub mod namespace_a {
     14   #![allow(dead_code)]
     15   #![allow(unused_imports)]
     16 
     17   use std::mem;
     18   use std::cmp::Ordering;
     19 
     20   extern crate flatbuffers;
     21   use self::flatbuffers::EndianScalar;
     22 
     23 pub enum TableInFirstNSOffset {}
     24 #[derive(Copy, Clone, Debug, PartialEq)]
     25 
     26 pub struct TableInFirstNS<'a> {
     27   pub _tab: flatbuffers::Table<'a>,
     28 }
     29 
     30 impl<'a> flatbuffers::Follow<'a> for TableInFirstNS<'a> {
     31     type Inner = TableInFirstNS<'a>;
     32     #[inline]
     33     fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
     34         Self {
     35             _tab: flatbuffers::Table { buf: buf, loc: loc },
     36         }
     37     }
     38 }
     39 
     40 impl<'a> TableInFirstNS<'a> {
     41     #[inline]
     42     pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
     43         TableInFirstNS {
     44             _tab: table,
     45         }
     46     }
     47     #[allow(unused_mut)]
     48     pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
     49         _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
     50         args: &'args TableInFirstNSArgs<'args>) -> flatbuffers::WIPOffset<TableInFirstNS<'bldr>> {
     51       let mut builder = TableInFirstNSBuilder::new(_fbb);
     52       if let Some(x) = args.foo_struct { builder.add_foo_struct(x); }
     53       if let Some(x) = args.foo_table { builder.add_foo_table(x); }
     54       builder.add_foo_enum(args.foo_enum);
     55       builder.finish()
     56     }
     57 
     58     pub const VT_FOO_TABLE: flatbuffers::VOffsetT = 4;
     59     pub const VT_FOO_ENUM: flatbuffers::VOffsetT = 6;
     60     pub const VT_FOO_STRUCT: flatbuffers::VOffsetT = 8;
     61 
     62   #[inline]
     63   pub fn foo_table(&self) -> Option<namespace_b::TableInNestedNS<'a>> {
     64     self._tab.get::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS<'a>>>(TableInFirstNS::VT_FOO_TABLE, None)
     65   }
     66   #[inline]
     67   pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS {
     68     self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()
     69   }
     70   #[inline]
     71   pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> {
     72     self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)
     73   }
     74 }
     75 
     76 pub struct TableInFirstNSArgs<'a> {
     77     pub foo_table: Option<flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a >>>,
     78     pub foo_enum: namespace_b::EnumInNestedNS,
     79     pub foo_struct: Option<&'a  namespace_b::StructInNestedNS>,
     80 }
     81 impl<'a> Default for TableInFirstNSArgs<'a> {
     82     #[inline]
     83     fn default() -> Self {
     84         TableInFirstNSArgs {
     85             foo_table: None,
     86             foo_enum: namespace_b::EnumInNestedNS::A,
     87             foo_struct: None,
     88         }
     89     }
     90 }
     91 pub struct TableInFirstNSBuilder<'a: 'b, 'b> {
     92   fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
     93   start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
     94 }
     95 impl<'a: 'b, 'b> TableInFirstNSBuilder<'a, 'b> {
     96   #[inline]
     97   pub fn add_foo_table(&mut self, foo_table: flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) {
     98     self.fbb_.push_slot_always::<flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table);
     99   }
    100   #[inline]
    101   pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) {
    102     self.fbb_.push_slot::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, foo_enum, namespace_b::EnumInNestedNS::A);
    103   }
    104   #[inline]
    105   pub fn add_foo_struct(&mut self, foo_struct: &'b  namespace_b::StructInNestedNS) {
    106     self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
    107   }
    108   #[inline]
    109   pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableInFirstNSBuilder<'a, 'b> {
    110     let start = _fbb.start_table();
    111     TableInFirstNSBuilder {
    112       fbb_: _fbb,
    113       start_: start,
    114     }
    115   }
    116   #[inline]
    117   pub fn finish(self) -> flatbuffers::WIPOffset<TableInFirstNS<'a>> {
    118     let o = self.fbb_.end_table(self.start_);
    119     flatbuffers::WIPOffset::new(o.value())
    120   }
    121 }
    122 
    123 pub enum SecondTableInAOffset {}
    124 #[derive(Copy, Clone, Debug, PartialEq)]
    125 
    126 pub struct SecondTableInA<'a> {
    127   pub _tab: flatbuffers::Table<'a>,
    128 }
    129 
    130 impl<'a> flatbuffers::Follow<'a> for SecondTableInA<'a> {
    131     type Inner = SecondTableInA<'a>;
    132     #[inline]
    133     fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    134         Self {
    135             _tab: flatbuffers::Table { buf: buf, loc: loc },
    136         }
    137     }
    138 }
    139 
    140 impl<'a> SecondTableInA<'a> {
    141     #[inline]
    142     pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    143         SecondTableInA {
    144             _tab: table,
    145         }
    146     }
    147     #[allow(unused_mut)]
    148     pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    149         _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    150         args: &'args SecondTableInAArgs<'args>) -> flatbuffers::WIPOffset<SecondTableInA<'bldr>> {
    151       let mut builder = SecondTableInABuilder::new(_fbb);
    152       if let Some(x) = args.refer_to_c { builder.add_refer_to_c(x); }
    153       builder.finish()
    154     }
    155 
    156     pub const VT_REFER_TO_C: flatbuffers::VOffsetT = 4;
    157 
    158   #[inline]
    159   pub fn refer_to_c(&self) -> Option<super::namespace_c::TableInC<'a>> {
    160     self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC<'a>>>(SecondTableInA::VT_REFER_TO_C, None)
    161   }
    162 }
    163 
    164 pub struct SecondTableInAArgs<'a> {
    165     pub refer_to_c: Option<flatbuffers::WIPOffset<super::namespace_c::TableInC<'a >>>,
    166 }
    167 impl<'a> Default for SecondTableInAArgs<'a> {
    168     #[inline]
    169     fn default() -> Self {
    170         SecondTableInAArgs {
    171             refer_to_c: None,
    172         }
    173     }
    174 }
    175 pub struct SecondTableInABuilder<'a: 'b, 'b> {
    176   fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    177   start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
    178 }
    179 impl<'a: 'b, 'b> SecondTableInABuilder<'a, 'b> {
    180   #[inline]
    181   pub fn add_refer_to_c(&mut self, refer_to_c: flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) {
    182     self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c);
    183   }
    184   #[inline]
    185   pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SecondTableInABuilder<'a, 'b> {
    186     let start = _fbb.start_table();
    187     SecondTableInABuilder {
    188       fbb_: _fbb,
    189       start_: start,
    190     }
    191   }
    192   #[inline]
    193   pub fn finish(self) -> flatbuffers::WIPOffset<SecondTableInA<'a>> {
    194     let o = self.fbb_.end_table(self.start_);
    195     flatbuffers::WIPOffset::new(o.value())
    196   }
    197 }
    198 
    199 }  // pub mod NamespaceA
    200 
    201 pub mod namespace_c {
    202   #![allow(dead_code)]
    203   #![allow(unused_imports)]
    204 
    205   use std::mem;
    206   use std::cmp::Ordering;
    207 
    208   extern crate flatbuffers;
    209   use self::flatbuffers::EndianScalar;
    210 
    211 pub enum TableInCOffset {}
    212 #[derive(Copy, Clone, Debug, PartialEq)]
    213 
    214 pub struct TableInC<'a> {
    215   pub _tab: flatbuffers::Table<'a>,
    216 }
    217 
    218 impl<'a> flatbuffers::Follow<'a> for TableInC<'a> {
    219     type Inner = TableInC<'a>;
    220     #[inline]
    221     fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    222         Self {
    223             _tab: flatbuffers::Table { buf: buf, loc: loc },
    224         }
    225     }
    226 }
    227 
    228 impl<'a> TableInC<'a> {
    229     #[inline]
    230     pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    231         TableInC {
    232             _tab: table,
    233         }
    234     }
    235     #[allow(unused_mut)]
    236     pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    237         _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    238         args: &'args TableInCArgs<'args>) -> flatbuffers::WIPOffset<TableInC<'bldr>> {
    239       let mut builder = TableInCBuilder::new(_fbb);
    240       if let Some(x) = args.refer_to_a2 { builder.add_refer_to_a2(x); }
    241       if let Some(x) = args.refer_to_a1 { builder.add_refer_to_a1(x); }
    242       builder.finish()
    243     }
    244 
    245     pub const VT_REFER_TO_A1: flatbuffers::VOffsetT = 4;
    246     pub const VT_REFER_TO_A2: flatbuffers::VOffsetT = 6;
    247 
    248   #[inline]
    249   pub fn refer_to_a1(&self) -> Option<super::namespace_a::TableInFirstNS<'a>> {
    250     self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS<'a>>>(TableInC::VT_REFER_TO_A1, None)
    251   }
    252   #[inline]
    253   pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> {
    254     self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA<'a>>>(TableInC::VT_REFER_TO_A2, None)
    255   }
    256 }
    257 
    258 pub struct TableInCArgs<'a> {
    259     pub refer_to_a1: Option<flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a >>>,
    260     pub refer_to_a2: Option<flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a >>>,
    261 }
    262 impl<'a> Default for TableInCArgs<'a> {
    263     #[inline]
    264     fn default() -> Self {
    265         TableInCArgs {
    266             refer_to_a1: None,
    267             refer_to_a2: None,
    268         }
    269     }
    270 }
    271 pub struct TableInCBuilder<'a: 'b, 'b> {
    272   fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    273   start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
    274 }
    275 impl<'a: 'b, 'b> TableInCBuilder<'a, 'b> {
    276   #[inline]
    277   pub fn add_refer_to_a1(&mut self, refer_to_a1: flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) {
    278     self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1);
    279   }
    280   #[inline]
    281   pub fn add_refer_to_a2(&mut self, refer_to_a2: flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) {
    282     self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2);
    283   }
    284   #[inline]
    285   pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TableInCBuilder<'a, 'b> {
    286     let start = _fbb.start_table();
    287     TableInCBuilder {
    288       fbb_: _fbb,
    289       start_: start,
    290     }
    291   }
    292   #[inline]
    293   pub fn finish(self) -> flatbuffers::WIPOffset<TableInC<'a>> {
    294     let o = self.fbb_.end_table(self.start_);
    295     flatbuffers::WIPOffset::new(o.value())
    296   }
    297 }
    298 
    299 }  // pub mod NamespaceC
    300 
    301