MessagePackable

Handy helper for creating MessagePackable object.

toMsgpack / fromMsgpack are special methods for serialization / deserialization. This template provides those methods to struct/class.

Members

Functions

fromMsgpack
void fromMsgpack(Value value)

Deserializes MessagePack object to members using Value.

fromMsgpack
void fromMsgpack(ref Unpacker unpacker)

Deserializes MessagePack object to members using direct-conversion deserializer.

fromMsgpack
void fromMsgpack(Value value)

Member selecting version of fromMsgpack for Value.

fromMsgpack
void fromMsgpack(ref Unpacker unpacker)

Member selecting version of fromMsgpack for direct-converion deserializer.

toMsgpack
void toMsgpack(ref Packer packer, bool withFieldName = false)

Serializes members using packer.

toMsgpack
void toMsgpack(ref Packer packer, bool withFieldName = false)

Member selecting version of toMsgpack.

Examples

1 struct S
2 {
3    int num; string str;
4 
5    // http://d.puremagic.com/issues/show_bug.cgi?id = 1099
6    mixin MessagePackable;  // all members
7    // mixin MessagePackable!("num");  // num only
8 }

Defines those methods manually if you treat complex data-structure.

Meta