Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion: is the serialization format stable? #218
Comments
|
Also is there a document that describes the format itself? I'd like the understand how the encoding works. I looked around in the code and in the docs but didn't see anything. |
|
Someone in IRC helped me find the answer to this question. It isn't yet |
|
Yeah, I was going to chat with some people already using bincode and see if making this one last breaking change before 1.0 would be too much to deal with. I haven't found anyone that would be seriously hurt by this, so I'll probably make the change. |
|
For the second question, is there a spec or design notes or any other kind of design document I can look at to understand the format? I generally try to understand the underlying format when using binary encoders because it helps guide my structure design. |
|
Yeah, I should really write this up at some point and put it in the official docs. Here's a first draft. Primitives
Structs:The value of each field is written out in order packed down to the nearest byte EnumsThe tag of the enum is written (as a u32), and then the values of each field are written in order. Common Types
SummaryBincode writes the values out in a way that is very close to how the structures are laid out in memory. (the main difference is that bincode packs fields and structs much more aggressively because we don't need to worry about alignment issues). Because there is no structure information encoded in the payload, bincode requires that both the reader and writer of the data have the exact same struct/enum/etc definitions, so that Serde can generate serialization and deserialization methods that are exactly symmetrical. What this means for you:
|
|
Thank you |
I know the library itself isn't 1.0 but is the underlying format stable? If I design an API today that accepts bincode do I know that the format itself won't change?