mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 01:33:58 +00:00
Rust structz (#6539)
* Rust structz * struct of structs test * swift tmp variables Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -54,6 +54,8 @@ class Vec3
|
||||
|
||||
class Ability
|
||||
|
||||
class StructOfStructs
|
||||
|
||||
class Stat
|
||||
|
||||
class Referrable
|
||||
@@ -164,6 +166,28 @@ def CreateAbility(b_:flatbuffers_builder, id:int, distance:int):
|
||||
b_.PrependUint32(id)
|
||||
return b_.Offset()
|
||||
|
||||
class StructOfStructs : flatbuffers_handle
|
||||
def a():
|
||||
return MyGame_Example_Ability{ buf_, pos_ + 0 }
|
||||
def b():
|
||||
return MyGame_Example_Test{ buf_, pos_ + 8 }
|
||||
def c():
|
||||
return MyGame_Example_Ability{ buf_, pos_ + 12 }
|
||||
|
||||
def CreateStructOfStructs(b_:flatbuffers_builder, a_id:int, a_distance:int, b_a:int, b_b:int, c_id:int, c_distance:int):
|
||||
b_.Prep(4, 20)
|
||||
b_.Prep(4, 8)
|
||||
b_.PrependUint32(c_distance)
|
||||
b_.PrependUint32(c_id)
|
||||
b_.Prep(2, 4)
|
||||
b_.Pad(1)
|
||||
b_.PrependInt8(b_b)
|
||||
b_.PrependInt16(b_a)
|
||||
b_.Prep(4, 8)
|
||||
b_.PrependUint32(a_distance)
|
||||
b_.PrependUint32(a_id)
|
||||
return b_.Offset()
|
||||
|
||||
class Stat : flatbuffers_handle
|
||||
def id():
|
||||
return buf_.flatbuffers_field_string(pos_, 4)
|
||||
|
||||
Reference in New Issue
Block a user