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 upwhat is the behavior of deserialize_from #249
Comments
|
It won't know how many to read. Your deserialization code will only read one. |
|
If I were you, I'd put them in a vec and then serialize the vec. Otherwise, you could just keep reading until you run out of bytes in the file? |
how will it know the exact size of a Record, as each record will be of variable size. Let me put it another way, I am trying to understand if the below code is valid when Records are of variable size:
|
|
an update, |
|
Yes, it does know how to deserialize records of variable size. The only way that the record is variable-length is when the the length of your |
My struct looks as follows:
and then I write a loop to write around 1000 such Record appended to a file using serialize:
Now when I do deserialize as follows, will it read the first record, if so, how will it know the exact size to read. (I could not find anything related to this in the docs)
if not, what is a good/right way to read such data (for example the 1000 records mentioned above.)