-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amend 1192 (RangeInclusive) to just be a two-field struct
Rationale: 1. Having the variants make trying to use a RangeInclusive unergonomic. For example, `fn clamp(self, range: RangeInclusive<Self>)` is forced to deal with the `Empty` case. 2. The variants don't actually provide any offsetting safety or additional performance, since everything is pub so it's totally possible for a "`NonEmpty`" range to contain no elements. 3. This makes it more consistent with (half-open) `Range`. 4. The extra flag/variant is not actually needed in order to make it iterable, even using the existing Step trait. And supposing a more cut-down trait, generating `a, b` such that `!(a <= b)` is easier than other fundamental requirements of safe range iterability.
- Loading branch information
Showing
1 changed file
with
49 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters