import std.stdio;
import std.json;
import std.traits;
struct TestStruct
{
@("noserialize") int x;
int y;
int z;
}
void serialize(T)(T obj)
{
if (is(T == struct))
{
foreach (i, member; FieldNameTuple!T)
{
if (!hasUDA!(member, "noserialize"))
{
writeln(member);
}
}
} else {
assert(0, "Not a struct");
}
}
void main()
{
TestStruct ts;
ts.x = 1;
ts.y = 2;
ts.z = 3;
serialize(ts);
}
aW1wb3J0IHN0ZC5zdGRpbzsKaW1wb3J0IHN0ZC5qc29uOwppbXBvcnQgc3RkLnRyYWl0czsKCnN0cnVjdCBUZXN0U3RydWN0CnsKCUAoIm5vc2VyaWFsaXplIikgaW50IHg7CglpbnQgeTsKCWludCB6Owp9Cgp2b2lkIHNlcmlhbGl6ZShUKShUIG9iaikKewoJaWYgKGlzKFQgPT0gc3RydWN0KSkKCXsKCQlmb3JlYWNoIChpLCBtZW1iZXI7IEZpZWxkTmFtZVR1cGxlIVQpCgkJewoJCQlpZiAoIWhhc1VEQSEobWVtYmVyLCAibm9zZXJpYWxpemUiKSkKCQkJewoJCQkJd3JpdGVsbihtZW1iZXIpOwoJCQl9CgkJfQoJfSBlbHNlIHsKCQlhc3NlcnQoMCwgIk5vdCBhIHN0cnVjdCIpOwoJfQp9Cgp2b2lkIG1haW4oKQp7CglUZXN0U3RydWN0IHRzOwoJdHMueCA9IDE7Cgl0cy55ID0gMjsKCXRzLnogPSAzOwoJc2VyaWFsaXplKHRzKTsKfQo=