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.

beginRaw
void beginRaw(size_t length)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

pack
PackerImpl pack(T data)

Packs data as an extended value of type.

packArray
PackerImpl packArray(Types objects)

Serializes the arguments as container to stream.

packExt
PackerImpl packExt(byte type, ubyte[] data)

Packs data as an extended value of type.

packMap
PackerImpl packMap(Types objects)

Serializes the arguments as container to stream.

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

Properties

stream
Stream stream [@property getter]

Forwards to stream.

Static functions

register
void register()
Undocumented in source. Be warned that the author may not have intended to support it.
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.stream.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