PackerImpl

Packer is a MessagePack serializer

Constructors

this
this(Stream stream, bool withFieldName)

Constructs a packer with stream.

this
this(bool withFieldName)

Constructs a packer with withFieldName.

Members

Functions

beginArray
PackerImpl beginArray(size_t length)
beginMap
PackerImpl beginMap(size_t length)

Serializes the type-information to stream.

pack
PackerImpl pack(T value)

Serializes argument and writes to stream.

pack
PackerImpl pack(T value)
PackerImpl pack(T array)
PackerImpl pack(Types objects)

Overload for pack(null) for 2.057 or later

pack
PackerImpl pack(T object)

Serializes object and writes to stream.

packArray
PackerImpl packArray(Types objects)
packMap
PackerImpl packMap(Types objects)

Serializes the arguments as container to stream.

Properties

stream
Stream stream [@property getter]

Forwards to stream.

Static functions

registerHandler
void registerHandler()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

auto packer = packer(Appender!(ubyte[])());

packer.packArray(false, 100, 1e-10, null);

stdout.rawWrite(packer.buffer.data);

NOTE: Current implementation can't deal with a circular reference. If you try to serialize a object that has circular reference, runtime raises 'Stack Overflow'.

Meta