nim-serialization/serialization.nim

17 lines
387 B
Nim
Raw Normal View History

import
serialization/[streams, object_serialization]
export
streams, object_serialization
2018-11-29 01:33:45 +00:00
proc encodeImpl(w: var auto, value: auto): auto =
mixin writeValue, getOutput
w.writeValue value
return w.getOutput
2018-11-29 01:33:45 +00:00
template encode*(Writer: type, value: auto, params: varargs[untyped]): auto =
mixin init, writeValue, getOutput
var w = Writer.init(params)
encodeImpl(w, value)