deser/ser/make

Macros

macro makeSerializable(types: varargs[typedesc]; public: static[bool] = false;
                       debugOutput: static[bool] = false;
                       debugTreeOutput: static[bool] = false)

Generate serialize procedure for your type. Use public parameter to export.

Works only for objects and ref objects.

Compile with -d:debugMakeSerializable to see macro output. Compile with -d:debugMakeSerializableTree to see macro output as NimNode tree.

Example:

makeSerializable(Foo)

# Use array of types if you want to make deserializable many types
makeSerializable([
  Foo,
  Bar
])

  Source   Edit