Commit 2ed716a
authored
Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref`
Stabilizing `Bound::as_ref` will simplify the implementation for `RangeBounds<usize>` for custom range types:
```rust
impl RangeBounds<usize> for Region {
fn start_bound(&self) -> Bound<&usize> {
// TODO: Use `self.start.as_ref()` when upstream `std` stabilizes:
// #80996
match self.start {
Bound::Included(ref bound) => Bound::Included(bound),
Bound::Excluded(ref bound) => Bound::Excluded(bound),
Bound::Unbounded => Bound::Unbounded,
}
}
fn end_bound(&self) -> Bound<&usize> {
// TODO: Use `self.end.as_ref()` when upstream `std` stabilizes:
// #80996
match self.end {
Bound::Included(ref bound) => Bound::Included(bound),
Bound::Excluded(ref bound) => Bound::Excluded(bound),
Bound::Unbounded => Bound::Unbounded,
}
}
}
```
See:
- #80996
- #80996 (comment)
cc `@yaahc` who suggested partial stabilization.
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
680 | | - | |
| 680 | + | |
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| |||
0 commit comments