feat: add function to decode an entire slice - #23
Conversation
mattsse
left a comment
There was a problem hiding this comment.
sorry for the delay, only now enabled notifications on this...
| /// Additional trailing bytes found after decoding. | ||
| TrailingBytes, |
There was a problem hiding this comment.
I think this can be expressed with the Unexptectedlength variant
There was a problem hiding this comment.
Considering that this is currently returned when the payload length doesn't match the array size or other payload length issues, I didn't think it would be a good fit for this since decode_exact() doesn't look at the payload, but rather the entire RLP encoded data. However, if this is just me, I can definitely adjust `UnexpectedLength' to better account for both cases...
There was a problem hiding this comment.
I would be ok with the new variant however this is unfortunately a breaking change because the enum is not marked as #[non_exhaustive]. So for now I would prefer the other option and adding a TODO for the new variant
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
mattsse
left a comment
There was a problem hiding this comment.
this is reasonable and useful imo
any objections @Rjected @DaniPopes ?
This PR fixes #21 by adding the public function
decode_exactdescribed above. It also introduces a new error type, since none of the existing ones fit.This PR can be closed without merging if the
decode_exactfunction is deemed unnecessary in the context of this crate.PR Checklist