PMunch / protobuf-nim

Protobuf implementation in pure Nim that leverages the power of the macro system to not depend on any external tools
MIT License
171 stars 14 forks source link

provide easy serialization / deserialization #12

Open timotheecour opened 6 years ago

timotheecour commented 6 years ago

same as done here: https://github.com/oswjk/protobuf-nim/blob/master/README.md

let message = newTest1()
# ...
let data = serialize(message)
let message2 = newTest1(data)
assert message2 == message

This could be in addition to the existing stream based API:

var stream = newStringStream()
stream.write message
stream.setPosition(0)
var message2 = stream.readExampleMessage()