Are immutable structs supposed to work with FlatBuffers? I couldn't make the serialization/deserialization work both with and without the @STRUCT annotation.
I've added the following code under the TestInt8I struct definition in test/runtests.jl to get a smallest reproducible case:
struct TestInt8I
x::Int8
end
inst2 = TestInt8I(2)
b = FlatBuffers.Builder(TestInt8I)
FlatBuffers.build!(b, inst2)
t = FlatBuffers.Table(b)
inst2_1 = FlatBuffers.read(t)
@test inst2.x == inst2_1.x
The the test fails with:
ERROR: LoadError: EOFError: read end of file
Stacktrace:
[1] unsafe_read(::Base.AbstractIOBuffer{SubArray{UInt8,1,Array{UInt8,1},Tuple{UnitRange{Int64}},true}}, ::Ptr{UInt8}, ::UInt64) at ./iobuffer.jl:105
[2] unsafe_read(::Base.AbstractIOBuffer{SubArray{UInt8,1,Array{UInt8,1},Tuple{UnitRange{Int64}},true}}, ::Base.RefValue{Int32}, ::Int64) at ./io.jl:361
[3] read at ./io.jl:363 [inlined]
[4] read at ./io.jl:367 [inlined]
[5] get(::FlatBuffers.Table{TestInt8I}, ::Int64, ::Type{Int32}) at /Users/dm3/.julia/v0.6/FlatBuffers/src/internals.jl:8
[6] offset(::FlatBuffers.Table{TestInt8I}, ::Int64) at /Users/dm3/.julia/v0.6/FlatBuffers/src/internals.jl:18
[7] read(::FlatBuffers.Table{TestInt8I}, ::Type{TestInt8I}) at /Users/dm3/.julia/v0.6/FlatBuffers/src/FlatBuffers.jl:218
[8] read(::FlatBuffers.Table{TestInt8I}) at /Users/dm3/.julia/v0.6/FlatBuffers/src/FlatBuffers.jl:210
[9] include_from_node1(::String) at ./loading.jl:576
[10] include(::String) at ./sysimg.jl:14
[11] process_options(::Base.JLOptions) at ./client.jl:305
[12] _start() at ./client.jl:371
while loading /Users/dm3/.julia/v0.6/FlatBuffers/test/runtests.jl, in expression starting on line 64
Are immutable structs supposed to work with FlatBuffers? I couldn't make the serialization/deserialization work both with and without the
@STRUCT
annotation.I've added the following code under the
TestInt8I
struct definition intest/runtests.jl
to get a smallest reproducible case:The the test fails with: