nxt.serialization

Serialization.

Test: dmd -version=show -preview=dip1000 -preview=in -vcolumns -d -I.. -i -debug -g -checkaction=context -allinst -unittest -main -run serialization.d Test: ldmd2 -d -fsanitize=address -I.. -i -debug -g -checkaction=context -allinst -unittest -main -run serialization.d Debug: ldmd2 -d -fsanitize=address -I.. -i -debug -g -checkaction=context -allinst -unittest -main serialization.d && lldb serialization

TODO: Give compile-time error message when trying to serialize void* but not void[] TODO: Allocator supoprt TODO: Disable (de)serialization of nested types via !__traits(isNested, T) TODO: Support serialization of cycles and remove Code.failureCycle and sc. TODO: Use direct field setting for T only when __traits(isPOD, T) is true otherwise use __traits(getOverloads, T, "__ctor"). Try to use this to generalize (de)serialization of std.json.JSONValue to a type-agnostic logic inside inside generic main generic serializeRaw and deserializeRaw. TODO: Support bit-blitting of unions of only non-pointer fields. TODO: Only disable union's that contain any pointers. Detect using __traits, std.traits or gc_traits.d. TODO: Avoid call to new when deserializing arrays of immutable elements (and perhaps classes) when Sink element type E is immutable. TODO: Exercise JSONValue (de)serialization with nxt.sampling. TODO: Optimize (de)serialization when __traits(hasIndirections) is avaiable and __traits(hasIndirections, T) is false and enablesSlicing is set.

Members

Aliases

CodeUnitType
alias CodeUnitType = ubyte

Code (unit) type.

ConstructorParams
alias ConstructorParams = ParameterTypeTuple!(typeof(__traits(getOverloads, TestClass, "__ctor")[0]))
Undocumented in source.

Functions

deserializeRaw
Status deserializeRaw(Sink sink, T arg, Format fmt)

Raw (binary) deserialize arg from sink in format fmt.

deserializeRaw
Status deserializeRaw(AppenderSink sink, T arg, Format fmt)

Raw (binary) deserialize JSONValue arg from sink in format fmt.

serializeRaw
Status serializeRaw(Sink sink, T arg, Format fmt, size_t initialAddrsCapacity)

Raw (binary) serialize arg to sink in format fmt. TODO: Predict initialAddrsCapacity in callers.

Structs

Format
struct Format

Serialization format.

Status
struct Status

Status. Converts to bool true for failures to simplify control flow in (de)serialization functions.

Meta