encodeEnum

Helper to encode a DStyle enum ("entryName") as JSON style ("ENTRY_NAME").

Use like so: alias encode = encodeEnum!EnumType; when forming your encode overload.

string
encodeEnum
(
T
)
(
const T value
)
if (
is(T == enum)
)

Examples

ditto

import text.json.Encode : encodeJson;

enum Enum
{
    testValue,
    isHttp,
}

alias encode = encodeEnum!Enum;

encodeJson!(Enum, encode)(Enum.testValue).should.be(JSONValue("TEST_VALUE"));
encodeJson!(Enum, encode)(Enum.isHttp).should.be(JSONValue("IS_HTTP"));

Meta