How can I extend msgpack and submit a PR to support unpacking of std.variant.VariantN?
import std.variant: Algebraic;
import std.conv;
import std.stdio;
import std.traits;
import std.array: array;
import msgpack;
void main()
{
auto v = Algebraic!(long, double)(5.to!long);
assert(v == 5.to!long);
assert(v == 5.to!double);
assert(*(v.peek!long) == 5);
assert(v.peek!double is null);
writeln(`typeof(v.peek!double).stringof: `, typeof(v.peek!double).stringof);
writeln(`typeof(v).stringof: `, typeof(v).stringof);
writeln(`string.sizeof: `, string.sizeof);
writeln(`v.sizeof: `, v.sizeof);
writeln(`v.AllowedTypes.stringof: `, v.AllowedTypes.stringof);
auto vp = v.pack;
writeln(`typeof(v).stringof: `, typeof(v.pack).stringof);
writeln(`typeof(vp.unpack).stringof: `, typeof(vp.unpack).stringof);
writeln("v.pack.array: ", vp.array);
auto vr = vp.unpack;
assert(vp == vr);
}
compiles but deserialization errors at run-time as
typeof(v.peek!double).stringof: double*
typeof(v).stringof: VariantN!(8LU, long, double)
string.sizeof: 16
v.sizeof: 16
v.AllowedTypes.stringof: (long, double)
v.pack.array: [146, 168, 5, 0, 0, 0, 0, 0, 0, 0]
msgpack.UnpackException@/home/per/Work/justd/msgpack.d(305): Deserialization failure
Why does msgpack allow serialization but not deserialization?
Notice that VariantN is a struct type.
How can I extend msgpack and submit a PR to support unpacking of
std.variant.VariantN?compiles but deserialization errors at run-time as
Why does msgpack allow serialization but not deserialization?
Notice that
VariantNis astructtype.