let message = newTest1()
message.a = 150
## serialize
let data = protoToText(message)
echo data # a : 150
echo message # would use `$` as alias to serializeText
## deserialize
let message2 = Test1.deserializeText(data)
assert message2 == message
## serialize with option
let data = serializeText(message, oneline = false)
text format is very useful for debugging, or for cross language, human readable,, type safe, configuration files:
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.text_format
example of text format
https://github.com/BVLC/caffe/blob/master/models/bvlc_reference_caffenet/solver.prototxt
usage
WORKAROUND
same as https://github.com/msoucy/dproto/issues/71#issuecomment-365172146 : shell out to protoc eg:
workaround is not great, as not as efficient, and requires passing the proto file; the proper solution should involve using reflection