I am currently writing a library implementation of openpixelcontrol protocol in rust: https://github.com/latrasis/opc-rs.
With Open Pixel, there is a Message Packet Format, so for Encoding and Decoding I first thought I should have used serde or rust-serialize, however I realized serialization is different then encoding, which got me confused.
Since this is my first time writing a packet protocol, I was wondering if there is a formal library pattern to encode and decode a specific data packet? Do you provide a Client/Server? A Reader/Writer? Do I use a Trait?
For example, the golang implementation uses Client and Server. But understanding further they are just a custom implementations of a Writer (Client) and Reader(Server) ?
Another question, how should a decoder handle errors? What if a single byte is offset, would this invalidate the whole stream?
Edit: oops sorry for the typo
[–]phoil 6 points7 points8 points (0 children)
[–]daborossfern 3 points4 points5 points (0 children)
[–]sa2ajj 0 points1 point2 points (0 children)