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:
// https://github.com/rust-lang/rust/issues/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:
// https://github.com/rust-lang/rust/issues/80996
match self.end {
Bound::Included(ref bound) => Bound::Included(bound),
Bound::Excluded(ref bound) => Bound::Excluded(bound),
Bound::Unbounded => Bound::Unbounded,
}
}
}
```
See:
- #80996
- https://github.com/rust-lang/rust/issues/80996#issuecomment-1194575470
cc `@yaahc` who suggested partial stabilization.
|
||
|---|---|---|
| .. | ||
| alloc | ||
| backtrace@4e5a3f7292 | ||
| core | ||
| panic_abort | ||
| panic_unwind | ||
| portable-simd | ||
| proc_macro | ||
| profiler_builtins | ||
| rtstartup | ||
| rustc-std-workspace-alloc | ||
| rustc-std-workspace-core | ||
| rustc-std-workspace-std | ||
| std | ||
| stdarch@42df7394d3 | ||
| test | ||
| unwind | ||