msgpack_ll

A low-level pure @nogc and betterC MessagePack implementation.

Note: As this is a low-level implementation certain error checking a some handling of the MessagePack data format has to be done by the API user. The following conditions need to be ensured by the user:

  • When calling parseType the compile time type must match the actual data type or incorrect results will be returned. Use getType to verify the type before calling parseType.
  • The *fix types have certain maximum and minimum values. Read the source code and serach for DebugMsgpackLL or refer to the MessagePack specification for details.
  • The debug=DebugMsgpackLL debug version can be used to enable debug checks for these problems.

Requires only std.bitmanip for bigEndianToNative and nativeToBigEndian as external dependency.

TODO: Could try to avoid this dependency. This is only a compile time dependency anyway though, as these functions are templates and get inlined into this module.

Members

Enums

DataSize
eponymoustemplate DataSize(MsgpackType type)

Get serialized data size at compile time.

MsgpackType
enum MsgpackType

Enum of MessagePack types.

Functions

formatType
void formatType(typeof(null) value, ubyte[DataSize!type] data)
void formatType(ubyte[DataSize!type] data)
void formatType(bool value, ubyte[DataSize!type] data)
void formatType(ubyte value, ubyte[DataSize!type] data)
void formatType(byte value, ubyte[DataSize!type] data)
void formatType(ushort value, ubyte[DataSize!type] data)
void formatType(uint value, ubyte[DataSize!type] data)
void formatType(ulong value, ubyte[DataSize!type] data)
void formatType(short value, ubyte[DataSize!type] data)
void formatType(int value, ubyte[DataSize!type] data)
void formatType(long value, ubyte[DataSize!type] data)
void formatType(float value, ubyte[DataSize!type] data)
void formatType(double value, ubyte[DataSize!type] data)
void formatType(ubyte length, ubyte[DataSize!type] data)
void formatType(ushort length, ubyte[DataSize!type] data)
void formatType(uint length, ubyte[DataSize!type] data)
void formatType(ubyte extType, ubyte[1] value, ubyte[DataSize!type] data)
void formatType(ubyte extType, ubyte[2] value, ubyte[DataSize!type] data)
void formatType(ubyte extType, ubyte[4] value, ubyte[DataSize!type] data)
void formatType(ubyte extType, ubyte[8] value, ubyte[DataSize!type] data)
void formatType(ubyte length, ubyte extType, ubyte[DataSize!type] data)
void formatType(ushort length, ubyte extType, ubyte[DataSize!type] data)
void formatType(ubyte extType, ubyte[16] value, ubyte[DataSize!type] data)
void formatType(uint length, ubyte extType, ubyte[DataSize!type] data)

Serialize a value to a certain type.

getDataSize
size_t getDataSize(MsgpackType type)

Get serialized data size at runtime. DataSize!() should be preferred if the type is known at compile time.

getType
MsgpackType getType(ubyte value)

Look at the first byte of an object to determine the type.

parseType
auto parseType(ubyte[DataSize!type] data)
ubyte[DataSize!type - 1] parseType(ubyte[DataSize!type] data)

Parses the MessagePack object with specified type.

testExt
void testExt(T length, ubyte extType)
Undocumented in source. Be warned that the author may not have intended to support it.
testFixExt
void testFixExt(ubyte extType, T value)
Undocumented in source. Be warned that the author may not have intended to support it.
testFormat
void testFormat(T value)
Undocumented in source. Be warned that the author may not have intended to support it.
testFormatNoArg
void testFormatNoArg(T value)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

ExtType
struct ExtType

Serialization information about an ext type.

Meta