mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-28 03:07:24 +03:00
aad3710227
stabilize new RangeFrom type and iterator
```rust
// in core and std
pub mod range;
// in core::range
pub struct RangeFrom<Idx> {
pub start: Idx,
}
impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> { /* ... */ }
impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
pub const fn contains<U>(&self, item: &U) -> bool
where
Idx: [const] PartialOrd<U>,
U: ?Sized + [const] PartialOrd<Idx>;
}
impl<Idx: Step> RangeFrom<Idx> {
pub fn iter(&self) -> RangeFromIter<Idx>;
}
impl<T> const RangeBounds<T> for RangeFrom<T> { /* ... */ }
impl<T> const RangeBounds<T> for RangeFrom<&T> { /* ... */ }
impl<T> const From<RangeFrom<T>> for legacy::RangeFrom<T> { /* ... */ }
impl<T> const From<legacy::RangeFrom<T>> for RangeFrom<T> { /* ... */ }
pub struct RangeFromIter<A>(/* ... */);
// `RangeFromIter::remainder` left unstable
impl<A: Step> Iterator for RangeFromIter<A> {
type Item = A;
/* ... */
}
impl<A: Step> FusedIterator for RangeFromIter<A> { }
impl<A: Step> IntoIterator for RangeFrom<A> {
type Item = A;
type IntoIter = RangeFromIter<A>;
/* ... */
}
unsafe impl<T> const SliceIndex<[T]> for range::RangeFrom<usize> {
type Output = [T];
/* ... */
}
unsafe impl const SliceIndex<str> for range::RangeFrom<usize> {
type Output = str;
/* ... */
}
impl ops::Index<range::RangeFrom<usize>> for CStr {
type Output = CStr;
/* ... */
}
```
Tracking issue: https://github.com/rust-lang/rust/issues/125687