Refactor implementation of Decode::skip and Decode::encoded_fixed_size#587
Refactor implementation of Decode::skip and Decode::encoded_fixed_size#587kalaninja wants to merge 10 commits intoparitytech:masterfrom
Decode::skip and Decode::encoded_fixed_size#587Conversation
There was a problem hiding this comment.
Looks good.
When skipping we wouldn't do the descend_ref/ascend_ref. I don't if this is an issue.
I don't know if tests really test for skip, encoded_fixed_size.
Ideally we should have for every types, a bunch of value, with the expected encoded_fixed_size, then we test decode, skip and encoded_fixed_size.
# Conflicts: # src/codec.rs
|
I added some tests on your branch |
|
Thinking about I think we can call them, or we can just have a comment on the skip specification saying, skip doesn't take into account But at a first glance implementing skip with WDYT? |
|
Yes, I agree |
gui1117
left a comment
There was a problem hiding this comment.
Looks good to me, I added a minor test.
|
Hey @gui1117 |
Input::skipDecode::encoded_fixed_sizeDecode::skipBy default,
Input::skipdoes an actual read and discards the result, implementors should provide a specialized implementation.By default,
Decode::skipexecutesInput::skipfor types providingDecode::encoded_fixed_size. Otherwise, it is just callingDecode::decode., so implementors should provide a specialized implementation.As discussed in previous attempts that I found on github,
Decode::skipshouldn't validate the input data, providing a fast forward functionality instead. IMHO if a calling code wants to check for data integrity they can manually do something likelet _ = Decode::decode(input)?;Closes #208
Closes #244