SerializedT

Members

Aliases

SerializedT
alias SerializedT = string
Undocumented in source.
SerializedT
alias SerializedT = immutable(ubyte)[]
Undocumented in source.
SerializedT
alias SerializedT = immutable(void)[]
Undocumented in source.

Return Value

The serialized type for a given serializer. immutable(string) will match string, immutable(ubyte[]) will match immutable(ubyte)[], and everything that can convert to immutable(void)[] will match it.

Examples

static struct S (RT)
{
    public static RT serialize (T) (auto ref T value, uint opts = 42) @safe;
    // Ignored because it doesn't take 1 non-default parameter
    public static RT serialize (T) (T a, T b) @safe;
}

static assert(is(SerializedT!(S!string) == string));
static assert(is(SerializedT!(S!(immutable(string))) == string));
static assert(is(SerializedT!(S!(const(string))) == string));

static assert(is(SerializedT!(S!(immutable(ubyte[]))) == immutable(ubyte)[]));
static assert(is(SerializedT!(S!(immutable(ubyte)[])) == immutable(ubyte)[]));
static assert(is(SerializedT!(S!(const(immutable(ubyte)[]))) == immutable(ubyte)[]));

static assert(is(SerializedT!(S!(immutable(void[]))) == immutable(void)[]));
static assert(is(SerializedT!(S!(immutable(void)[])) == immutable(void)[]));
static assert(is(SerializedT!(S!(const(immutable(void)[]))) == immutable(void)[]));

static struct Struct { uint v; }
static assert(is(SerializedT!(S!(immutable(Struct)[])) == immutable(void)[]));

static struct Struct2 { void[] data; alias data this; }
static assert(is(SerializedT!(S!(immutable(Struct2))) == immutable(void)[]));

static assert(!is(typeof(SerializedT!(S!(ubyte[])))));
static assert(!is(typeof(SerializedT!(S!(void[])))));
static assert(!is(typeof(SerializedT!(S!(char[])))));

Meta