Skip to content

Conversation

@valadaptive
Copy link
Contributor

  • Added a CHANGELOG.md entry

Summary

This PR switches from using bincode to postcard as the intermediate encoding for the serde roundtrip tests.

Motivation

Someone in contact with the bincode maintainers has mentioned that it's not really maintained anymore and recommended the ecosystem switch away from it:

Bincode has spent a good probably most of its life at this point only being barely maintained with an occasional punctuation of activity, and help from the community has not been forthcoming (while a large part of that is because bincode is largely done as in feature complete and has been for some time, given it's maintenance status, it's quite frankly terrifying how much of the rust ecosystem depends on it, many of these projects would be much better served in multiple ways by using something that's not bincode).

I don't think it's particularly important that we stop using bincode here for any technical reasons; rather, it's because rand is a very popular reverse dependency of bincode, and probably contributes to its popularity. If popular crates switch to something else, we can hopefully reduce the number of people who reach for bincode simply due to its popularity.

Details

For the rand_pcg tests, I've removed the boilerplace with BufReader/BufWriter and switched to serializing to a Vec and deserializing from it. This is partly because postcard doesn't have their std::io interface quite worked out yet. Everything else is a fairly straightforward port.

Copy link
Member

@dhardy dhardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @valadaptive, LGTM.

I don't know much about postcard, but it appears to be actively developed at least.

@dhardy dhardy merged commit 8336923 into rust-random:master Dec 16, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants