-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/refactor(rlp): improve implementations #182
Conversation
e25552c
to
34df39d
Compare
34df39d
to
474d0d7
Compare
8188f65
to
e7af9f2
Compare
e7af9f2
to
5e40bd2
Compare
} | ||
} | ||
|
||
impl<E: Decodable> Decodable for alloc::vec::Vec<E> { | ||
#[cfg(feature = "smol_str")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does smol_str have a motivating usecase downstream? It's not really a common library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From reth-rlp, I'm assuming it's used somewhere there but I haven't verified that
Motivation
Refactor decode and add new impls and features.
Preferably
Decodable
would have a'de
lifetime, 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::decode
to use a match expression.smol_str
dep + feature fromreth-rlp
arrayvec
impls + gateencode_fixed_size
function to featureencode_*
functions' generics#[doc(hide)]
and documentMaxEncodedLen
,MaxEncodedLenAssoc
Result
type alias for the decode error typePR Checklist