import std.conv; // represented as a string when serialized static struct S { int value; // dummy example implementations string toString() const { return value.to!string(); } static S fromString(string s) { return S(s.to!int()); } } static assert(isStringSerializable!S);
Checks if a given type has a string serialization representation.
A class or struct type is string serializable if it defines a pair of toString/fromString methods. Any class or struct type that has this trait will be serialized by using the return value of it's toString method instead of the original value.