The OpenD Programming Language

serdeGetKeysIn

  1. template serdeGetKeysIn(alias symbol)
  2. immutable(string)[] serdeGetKeysIn(T value)
    @trusted pure nothrow @nogc
    immutable(string)[]
    serdeGetKeysIn
    (
    T
    )
    (
    const T value
    )
    if (
    is(T == enum)
    )

Return Value

Type: immutable(string)[]

immutable array of the input keys for the symbol or enum value

Examples

struct S
{
    int f;

    @serdeKeys("D", "t")
    int d;

    @serdeIgnore
    int i;

    @serdeIgnoreIn
    int ii;

    @serdeIgnoreOut
    int io;

    void p(int) @property {}
}

static assert(serdeGetKeysIn!(S.f) == ["f"]);
static assert(serdeGetKeysIn!(S.d) == ["D", "t"]);
static assert(serdeGetKeysIn!(S.i) == null);
static assert(serdeGetKeysIn!(S.ii) == null);
static assert(serdeGetKeysIn!(S.io) == ["io"]);
static assert(serdeGetKeysIn!(S.p) == ["p"]);
enum E
{
    @serdeKeys("A", "alpha")
    a,
    @serdeKeys("B", "beta")
    b,
    c,
}

static assert (serdeGetKeysIn(E.a) == ["A", "alpha"], serdeGetKeysIn(E.a));
static assert (serdeGetKeysIn(E.c) == ["c"]);

Meta