~tdeo/serde_bare#4: 
Allow streaming deserialising / getting the remainder of slice

The current deserialise functions seem to consume a reader or a slice, but don't give information about how many bytes were consumed, or so on.

It would be nice to be able to continue deserialising further messages in the stream, since I think the length of the data is clear from the format anyway?

Status
RESOLVED INVALID
Submitter
~reivilibre
Assigned to
No-one
Submitted
3 years ago
Updated
15 days ago
Labels
No labels applied.

~tdeo 3 years ago

Hi, I think for slices you should be able to do this using std::io::Cursor's position() method, and using from_reader instead of from_slice.

I'm not sure if there's a convenient wrapper for other readers, though.

~reivilibre REPORTED INVALID 3 years ago

You're right, you can use a &mut Cursor (or indeed &mut W where W is any other Write implementation!).

Thanks for your time :).

Register here or Log in to comment, or comment via email.