Serializer.serialize

Serializes the data in src.

Note that the serialization process may expand the dst buffer more than ultimately necessary, but it always returns a slice into the buffer that covers bytes of the struct instance itself, not including any of indirections (that are placed after). Therefore calling applications should be careful to use the returned buffer rather than the dst buffer directly.

  1. void[] serialize(S src, Buffer!(void) dst)
    struct Serializer
    static
    void[]
    serialize
    (
    S
    )
    (
    ref S src
    ,
    ref Buffer!(void) dst
    )
    out (data) { debug(SerializationTrace) { Stdout.formatln("< serialize!({})(<src>, {}) : {}", S.stringof, dst[].ptr, data.ptr); } }
  2. void[] serialize(S src, D[] dst)
  3. void[] serialize(Contiguous!(S) src)

Parameters

S

type of the struct to dump

src S

struct to serialize

dst Buffer!(void)

buffer to write to. It is only extended if needed and never shrunk

Return Value

Type: void[]

the slice to the serialize data

Meta