vigna/epserde-rs

Consider using a ReadNotStd + ReadWithCnt in deserialize_full_copy

Closed this issue · 0 comments

vigna commented

Currently, deserialize_full_copy takes a slice of u8 as deserialize_eps_copy. This however is not necessary, as a full copy can be obtained reading from a file.

We could define a ReadNoStd parallel to WriteNoStd and a ReadWithCnt. deserialize_full_copy would take a ReadWithCnt and deserialize from there. When passing from ε to full, one would wrap the current Cursor with a suitable ReadWithCnt. In fact, Cursor might directly implement ReadWithCnt, which would make passing from ε to full trivial.

At that point instead of just load we would have load_eps, doing what currently load does, and load_full, acting like a standard deserialization mechanism.

The disadvantage is that we would have to write a few deserialize_full_copy in ReadWithCnt style, instead of delegating or reading from a Cursor.