-
Notifications
You must be signed in to change notification settings - Fork 211
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
rlp: add ArrayVec impls #432
Conversation
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.
A few tests would be good: normal, zero-length, beyond capacity.
@@ -79,6 +79,44 @@ impl Decodable for Vec<u8> { | |||
} | |||
} | |||
|
|||
#[cfg(feature = "arrayvec")] |
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.
I think you missed adding this feature to Cargo.toml
.
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.
Optional dependencies are features in themselves.
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.
TIL! 👍
(I'd still want all features in the Cargo.toml
, preferably documented, for discoverability reasons)
I don't want to be naysayer but this is a slippery slope here; |
My concrete use case is for https://github.com/ethereum/devp2p/blob/master/discv4.md#neighbors-packet-0x04 It is a given that the reply is a limited-size vec of up to 16 elements. Would be nice to embed this property in the type system, but for that I need RLP to support any limited-size vec implementation. I suppose |
Thank you for the motivation, it's much clearer now. I'm still hesitant. Even if it's an optional dependency, it still needs maintenance. The future of |
@vorot93 is this PR still relevant now that we have |
I see, I thought the reason was to avoid allocations which, it seems, you were able to achieve with |
Useful for limited-size lists.