`DragValue::clamp_range` should accept any `impl RangeBounds`
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Is your feature request related to a problem? Please describe.**
Currently, `DragValue::clamp_range` takes an `InclusiveRange`, which necessitates specifying *both* endpoints in all cases. This leads to calls like `.clamp_range(0.0..=f32::MAX)`, which is verbose.
**Describe the solution you'd like**
If `clamp_range` took any `RangeBounds` implementor, users can call it with half-open ranges like `.clamp_range(0.0..)`, which is more convenient.
**Describe alternatives you've considered**
It could be left as-is, or you could go further and rename the method to `clamp` to make it even shorter. I use it a lot in my project, so it would make a difference.
Contributor guide
Research direction
Start by locating the `DragValue::clamp_range` implementation and any tests covering its current `InclusiveRange` argument. Check how range bounds are represented elsewhere in the Rust API, then verify that half-open calls such as `.clamp_range(0.0..)` work while existing inclusive calls remain supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100