The OpenD Programming Language

print

Prints structs and unions

Examples

static struct A { scope void toString(C, W)(scope ref W w) const { w.put(C('a')); } }
static struct S { scope void toString(W)(scope ref W w) const { w.put("s"); } }
static struct D { scope void toString(Dg)(scope Dg sink) const { sink("d"); } }
static struct F { scope const(char)[] toString()() const return { return "f"; } }
static struct G { const(char)[] s = "g"; alias s this; }

import mir.appender: scopedBuffer;
auto w = scopedBuffer!char;
assert(stringBuf << A() << S() << D() << F() << G() << getData == "asdfg");

Meta