StructSerializer

Struct serializer

Members

Static functions

copyReferences
S* copyReferences(S* src, S* dst)

Copies all references from dst to src.

deserialize
void deserialize(S* s, Deserializer deserializer, D[] data)

Loads/deserializes the content of s and its array members, using the given deserializer object. The deserializer object needs the following methods:

dump
size_t dump(S* s, OutputStream output)

Dumps/serializes the content of s and its array members, writing serialized data to output.

dump
size_t dump(S* s, void delegate(void[] data) receive)

Dumps/serializes the content of s and its array members.

load
size_t load(S* s, InputStream input)

Loads/deserializes the content of s and its array members, reading serialized data from input.

load
size_t load(S* s, void delegate(void[] data) receive)

Loads/deserializes the content of s and its array members.

resetReferences
S* resetReferences(S* s)

Resets all references in s to null.

serialize
void serialize(S* s, Serializer serializer, D data)

Dumps/serializes the content of s and its array members, using the given serializer object. The serializer object needs the following methods:

transmit
size_t transmit(S* s, void delegate(void[] data) transmit_data)

Dumps/serializes or loads/deserializes the content of s and its members.

transmitArray
size_t transmitArray(T[] array, void delegate(void[] data) transmit_dg)

Transmits (sends or receives) the serialized data of array. That is, first transmit the array content byte length as size_t value, then the array content raw data.

transmitArrays
size_t transmitArrays(S* s, void delegate(void[] array) transmit)

Transmits (sends or receives) the serialized data of all array fields in s.

Templates

AssertSupportedArray
template AssertSupportedArray(T, U, S, size_t i)

Asserts that T, which is an array of U and the type of the i-th field of S, is a supported array field type for struct serialization; multi-dimensional arrays and arrays of reference types or structs are currently not supported.

AssertSupportedType
template AssertSupportedType(T, S, size_t i)

Asserts that T, which is the type of the i-th field of S, is a supported field type for struct serialization; typedefs and unions are currently not supported. Warns if T is an associative array.

FieldInfo
template FieldInfo(T, S, size_t i)

Generates a struct field information string for messages

Parameters

AllowUnions

if true, unions will be serialized as raw bytes, without checking whether the union contains dynamic arrays. Otherwise unions cause a compile-time error.

TODO: proper union support -- must recurse into unions looking for dynamic arrays

Meta