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(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(Unpacker unpacker)

Member selecting version of fromMsgpack for direct-converion deserializer.

toMsgpack
void toMsgpack(Packer packer, bool withFieldName)

Serializes members using packer.

toMsgpack
void toMsgpack(Packer packer, bool withFieldName)

Member selecting version of toMsgpack.

Examples

struct S
{
    int num; string str;

    // http://d.puremagic.com/issues/show_bug.cgi?id = 1099
    mixin MessagePackable;  // all members
    // mixin MessagePackable!("num");  // num only
}

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

Meta