feat/refactor(rlp): improve implementations#182
Merged
Conversation
e25552c to
34df39d
Compare
34df39d to
474d0d7
Compare
8188f65 to
e7af9f2
Compare
e7af9f2 to
5e40bd2
Compare
prestwich
reviewed
Jul 9, 2023
prestwich
reviewed
Jul 9, 2023
| } | ||
|
|
||
| impl<E: Decodable> Decodable for alloc::vec::Vec<E> { | ||
| #[cfg(feature = "smol_str")] |
Member
There was a problem hiding this comment.
does smol_str have a motivating usecase downstream? It's not really a common library
Member
Author
There was a problem hiding this comment.
From reth-rlp, I'm assuming it's used somewhere there but I haven't verified that
prestwich
reviewed
Jul 9, 2023
prestwich
reviewed
Jul 9, 2023
prestwich
approved these changes
Jul 9, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Refactor decode and add new impls and features.
Preferably
Decodablewould have a'delifetime, andDecodable::decode's param would be a&mut Decoder<'de>struct which would allow for easier helper method access (likeHeader::decode->d.decode_header()?;etc), and deserializing borrowed byte and string slices, but this would be a significant breaking change so I didn't implement this here.Solution
Header, and by refactoringHeader::decodeto use a match expression.smol_strdep + feature fromreth-rlparrayvecimpls + gateencode_fixed_sizefunction to featureencode_*functions' generics#[doc(hide)]and documentMaxEncodedLen,MaxEncodedLenAssocResulttype alias for the decode error typePR Checklist