static struct WithMax(T, T max_) { T value; alias value this; enum T max = max_; } enum E { a, b, c } alias D6 = WithMax!(uint, 6); static struct S { ubyte a; bool b; E[3] e; D6 d; } alias Coder = SerializationCoder!(MixedRadixCoder!(uint, ulong, true), S); auto s = S(1, true, [E.a, E.b, E.c], D6(4)); assert(Coder.deserialize(Coder.serialize(s)) == s);
Serializes structs and static arrays using a MixedRadixCoder. Consults types' `.max' property to obtain cardinality.