prost
prost copied to clipboard
Is there an example of properly reading a stream of messages from std::io::Read?
I see Prost contains functions for doing length-prefixed message streaming.
Is there an example of how to properly read such stream of messages from stdin, handling short reads, without extra copying around, sane and readable?
Prost seems to live in bytes world and it is not clear how to connect it to std::io world.
I've found this, which helped me with implementing my own message serializer/deserializer.
AFAICT, Google's protocol buffers are not aware of streaming, so you need to manually prefix the length of the message to the stream, load the bytes in a buffer, and then use Prost to decode the message.
Hope this helps anyone!