prost icon indicating copy to clipboard operation
prost copied to clipboard

Add test cases for decoding varint in a split Buf

Open jaskij opened this issue 4 years ago • 0 comments

#530 shouldn't pass the tests. As I've said in a comment there, Buf may be split across multiple chunks and all the bytes for the varint we're decoding are not guaranteed to be in the first one.

This is an edge case, but by taking in &mut Buf the function is obligated to handle this case.

Perhaps adding a separate function, something like a thin wrapper around decode_varint_slice would be a better option if memory is guaranteed to be contiguous?

jaskij avatar Nov 03 '21 21:11 jaskij