-
Notifications
You must be signed in to change notification settings - Fork 13.3k
impl<T> SliceIndex<[T]> for (Bound<usize>, Bound<usize>) #49976
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
On second thought, after seeing how meager libcore's test suite is for the existing indexing operations, I have decided that I should stop trusting the standard library and start contributing to it myself. Working on a PR. Edit: awww, looks like there's actually a good reason why there's no tests with Edit 2: How on earth does |
@ExpHP do you still have plans to make a PR for this feature? |
Nope, totally forgot about this! Feel free to take the reins. (looking back, it seems I went ahead with the test suite PR (#50010), but that took long enough to merge that by the time it was done I must have moved on to other things.) |
…und_pair, r=m-ou-se Implement indexing slices with pairs of core::ops::Bound<usize> Closes rust-lang#49976. I am not sure about code duplication between `check_range` and `into_maybe_range`. Should be former implemented in terms of the latter? Also this PR doesn't address code duplication between `impl SliceIndex for Range*`.
…und_pair, r=m-ou-se Implement indexing slices with pairs of core::ops::Bound<usize> Closes rust-lang#49976. I am not sure about code duplication between `check_range` and `into_maybe_range`. Should be former implemented in terms of the latter? Also this PR doesn't address code duplication between `impl SliceIndex for Range*`.
…und_pair, r=m-ou-se Implement indexing slices with pairs of core::ops::Bound<usize> Closes rust-lang#49976. I am not sure about code duplication between `check_range` and `into_maybe_range`. Should be former implemented in terms of the latter? Also this PR doesn't address code duplication between `impl SliceIndex for Range*`.
…und_pair, r=m-ou-se Implement indexing slices with pairs of core::ops::Bound<usize> Closes rust-lang#49976. I am not sure about code duplication between `check_range` and `into_maybe_range`. Should be former implemented in terms of the latter? Also this PR doesn't address code duplication between `impl SliceIndex for Range*`.
These feel like an omission to me, given how
RangeArgument
is implemented for this type:And if we really want to go for feature parity, then
RangeArgument
also has impls for(Bound<&T>, Bound<&T>)
, but I think that's mostly for the sake of methods likeBTreeSet::range
, and it really doesn't make sense here.Edit: Then again, considering that RangeArgument is going to have methods that return
Bound<&T>
, maybe(Bound<&usize>, Bound<&usize>)
is worth it.(secretly, I just want the standard library to implement my bounds-checking and length-computation for me in my n-dimensional array, so that I can just write
vec![(); len][(start_bound, end_bound)].len()
and trust that it's correct. But shhhhhh, don't tell anyone)The text was updated successfully, but these errors were encountered: