Hi there,
I’m trying to use ProtoBuf to serialize data but I’m coming across an error I don’t know how to solve:
MWE:
using ProtoBuf
abstract type MyAbstractType end
struct MyType <: MyAbstractType
ts::UInt64
symbol::String
price::Float32
size::Float32
end
pb = PipeBuffer()
test = MyType(time_ns(), "Test", 100, 10)
msg = writeproto(pb, test)
The error I get is:
MethodError: no method matching meta(::Type{MyType})
Closest candidates are:
meta(::ProtoMeta, ::Type, ::Vector{Pair{Symbol, Union{String, Type}}}, ::Vector{Symbol}, ::Vector{Int64}, ::Dict{Symbol, Any}) at /home/jcooper/.julia/packages/ProtoBuf/l7nsO/src/codec.jl:576
meta(::ProtoMeta, ::Type, ::Vector{Pair{Symbol, Union{String, Type}}}, ::Vector{Symbol}, ::Vector{Int64}, ::Dict{Symbol, Any}, ::Vector{Symbol}) at /home/jcooper/.julia/packages/ProtoBuf/l7nsO/src/codec.jl:576
meta(::ProtoMeta, ::Type, ::Vector{Pair{Symbol, Union{String, Type}}}, ::Vector{Symbol}, ::Vector{Int64}, ::Dict{Symbol, Any}, ::Vector{Symbol}, ::Dict) at /home/jcooper/.julia/packages/ProtoBuf/l7nsO/src/codec.jl:576
...
Stacktrace:
[1] writeproto(io::IOBuffer, obj::MyType)
@ ProtoBuf ~/.julia/packages/ProtoBuf/l7nsO/src/codec.jl:419
[2] top-level scope
@ In[20]:16
[3] eval
@ ./boot.jl:360 [inlined]
[4] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1094
I don’t understand this error at all. If anyone has any experience with this package guidance would be appreciated.
As an aside is there any downside to using the Serialization package from stdlib instead if I only intend on programming in Julia?
Thanks.