-
Notifications
You must be signed in to change notification settings - Fork 151
Implement bincode2 encode/decode support for smallvec v1 #375
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
Merged
Conversation
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
We want to add an optional dependency on bincode 2. The MSRV of bincode 2 is too high for us to use it in the tests, so rename the test usage to bincode1 in preparation.
Add implementations for `bincode`'s `Encode`, `Decode` and `BorrowDecode`. Like `bincode` itself, we implement optimizations when the vector item is `u8` so that `SmallVec<[u8; N]>` can be encoded and decoded with just a memory copy.
mbrubeck
requested changes
Apr 4, 2025
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.
Thanks, this looks good!
mbrubeck
reviewed
Apr 4, 2025
mbrubeck
approved these changes
Apr 5, 2025
facebook-github-bot
pushed a commit
to facebookexperimental/rust-shed
that referenced
this pull request
Apr 18, 2025
Summary: Vendor smallvec v1 with support for bincode v2 encoding and decoding. This was implemented in PR servo/rust-smallvec#375 which is in release 1.15.0. Reviewed By: RajivTS Differential Revision: D72465918 fbshipit-source-id: 04ddf5c05de7d3a9d5dea619dca331f46a40943b
facebook-github-bot
pushed a commit
to facebook/sapling
that referenced
this pull request
Apr 18, 2025
Summary: Vendor smallvec v1 with support for bincode v2 encoding and decoding. This was implemented in PR servo/rust-smallvec#375 which is in release 1.15.0. Reviewed By: RajivTS Differential Revision: D72465918 fbshipit-source-id: 04ddf5c05de7d3a9d5dea619dca331f46a40943b
facebook-github-bot
pushed a commit
to facebook/fbthrift
that referenced
this pull request
Apr 18, 2025
Summary: Vendor smallvec v1 with support for bincode v2 encoding and decoding. This was implemented in PR servo/rust-smallvec#375 which is in release 1.15.0. Reviewed By: RajivTS Differential Revision: D72465918 fbshipit-source-id: 04ddf5c05de7d3a9d5dea619dca331f46a40943b
facebook-github-bot
pushed a commit
to facebookincubator/reindeer
that referenced
this pull request
Apr 18, 2025
Summary: Vendor smallvec v1 with support for bincode v2 encoding and decoding. This was implemented in PR servo/rust-smallvec#375 which is in release 1.15.0. Reviewed By: RajivTS Differential Revision: D72465918 fbshipit-source-id: 04ddf5c05de7d3a9d5dea619dca331f46a40943b
facebook-github-bot
pushed a commit
to facebook/hhvm
that referenced
this pull request
Apr 18, 2025
Summary: Vendor smallvec v1 with support for bincode v2 encoding and decoding. This was implemented in PR servo/rust-smallvec#375 which is in release 1.15.0. Reviewed By: RajivTS Differential Revision: D72465918 fbshipit-source-id: 04ddf5c05de7d3a9d5dea619dca331f46a40943b
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.
We would like to use bincode v2 to encode some structures that contain smallvecs. Now that bincode v2 has been released, we can add optional implementations of its traits to smallvec.
This PR implements support in smallvec v1 if the optional
impl_bincode
feature is specified. Similarly to how bincode has optimizations forVec<u8>
, it includes optimizations forSmallVec<[u8; N]>
.Note that I have not updated the existing dev-dependency on
bincode
that is used in tests. This is because bincode v2 has a fairly high MSRV (1.85.0).