rust-random / rust-random/rand
Extend the `impl_sample_range_u` to implement the new `std/core::range::Range*` types.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 512
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 7
Description
Background
What is your motivation?
Rust 1.96.0 introduced new Range types, and I'd like to use SampleRange for them.
What type of application is this? (E.g. cryptography, game, numerical simulation)
Nothing specific, more related to API surface.
Feature request
Extend the impl_sample_range_u so that they also implement SampleRange for for core::range::RangeToInclusive, core::range::RangeToInclusiveIter, core::range::RangeFromcore::range::RangeFromIter, core::range::Range, core::range::RangeIter
One concern is that we'd have to do something to only include this code when the Rust compiler is new enough.
We can use a feature to manually enable the impl, which would be the easiest. It wouldn't break consumers on <1.96.0, and for consumers >=1.96.0 they'd have to enable it manually. Or if we'd like to have it automatically we can use https://crates.io/crates/version_check or https://crates.io/crates/rustversion to guard it against Rust's version.
Thankfully range already has edition = 2024, so that's not blocking us.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading impl_sample_range_u and the existing SampleRange implementations to understand how range types are handled. Then inspect the crate's compiler-version or feature-gating approach; done means the listed Range and Range iterator types implement SampleRange without breaking consumers on older Rust versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100