Unpacker

This Unpacker is a MessagePack direct-conversion deserializer

This implementation is suitable for fixed data.

Constructors

this
this(ubyte[] target, size_t bufferSize, bool withFieldName)

Constructs a Unpacker.

Members

Functions

beginArray
size_t beginArray()
beginMap
size_t beginMap()

Deserializes the type-information of container.

clear
void clear()

Clears states for next deserialization.

opApply
int opApply(int delegate(ref Types) dg)

Scans an entire buffer and converts each objects.

scan
int scan(int delegate(ref Types) dg)

Scans an entire buffer and converts each objects.

unpack
Unpacker unpack(T value)
Unpacker unpack(Types objects)

Deserializes T object and assigns to value.

unpack
Unpacker unpack(T array)

Deserializes T object and assigns to array.

unpack
Unpacker unpack(T object, Args args)
Unpacker unpack(T object)

Deserializes T object and assigns to object.

unpackArray
Unpacker unpackArray(Types objects)

Deserializes the container object and assigns to each argument.

unpackExt
Unpacker unpackExt(byte type, ubyte[] data)

Unpacks an EXT value into type and data. type is checked and a MessagePackException is thrown if it does not match. The length of data is checked and a MessagePackException is thrown if the lengths do not match. If data is null, a new slice is returned.

unpackMap
Unpacker unpackMap(Types objects)

Deserializes the container object and assigns to each argument.

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

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.

Mixed In Members

From mixin InternalBuffer

buffer
ubyte[] buffer [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
feed
void feed(ubyte[] target)
Undocumented in source.
bufferConsumed
void bufferConsumed(size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
removeUnparsed
void removeUnparsed()
Undocumented in source. Be warned that the author may not have intended to support it.
size
size_t size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
parsedSize
size_t parsedSize [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
unparsedSize
size_t unparsedSize [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

// serializedData is [10, 0.1, false]
auto unpacker = Unpacker(serializedData);

uint   n;
double d;
bool   b;

unpacker.unpackArray(n, d, b);

// using Tuple
Tuple!(uint, double, bool) record;
unpacker.unpack(record);  // record is [10, 0.1, false]

NOTE: Unpacker becomes template struct if Phobos supports truly IO module.

Meta