Skip to content

Conversation

@dhardy
Copy link
Member

@dhardy dhardy commented Nov 24, 2025

  • Added a CHANGELOG.md entry

Summary

Remove serde as an (optional) feature.

Motivation

rand_core is intended to be a pure interface crate; as such it should not depend on anything else.

Details

This doesn't affect chacha20 since RustCrypto/stream-ciphers#461.

It also doesn't outright prevent block-based RNGs from supporting serde; it is possible to write remote adapters for foreign types which do not support it, but allowing this would require:

  • read support for BlockRng::results (or only the unused subset)
  • read support for BlockRng64::results, half_used
  • construction support for BlockRng and BlockRng64 from parts

Ultimately (once rand_core is stable at v1.0) we could try to get this support merged into serde itself, but even if we don't, the loss of serde support for BlockRng should be acceptable.

Unresolved questions

Do we want to provide some way to serialize and deserialize partial buffers?

I suggest the answer should be no: downstream RNGs already support getting/setting the stream position without this.

Exception: BlockRng64 isn't used much. The only application of it we provide (Isaac64Rng) does not support set/get stream position. I think we shouldn't worry about it (and even consider removing it) simply due to the low usage.

Future work

#24 can be re-evaluated independently of serde.

@dhardy dhardy merged commit 5d57a94 into master Nov 24, 2025
13 checks passed
@dhardy dhardy deleted the remove-serde branch November 24, 2025 10:30
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.

3 participants