Skip to content

Extend the impl_sample_range_u to implement the new std/core::range::Range* types. #1784

@kristof-mattei

Description

@kristof-mattei

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions