new_range_api #125687)
The types within this module are meant to replace the existing Range, RangeInclusive, and RangeFrom types in a future edition.
#![feature(new_range_api)]
use core::range::{Range, RangeFrom, RangeInclusive};
let arr = [0, 1, 2, 3, 4];
assert_eq!(arr[ .. ], [0, 1, 2, 3, 4]);
assert_eq!(arr[ .. 3 ], [0, 1, 2 ]);
assert_eq!(arr[ ..=3 ], [0, 1, 2, 3 ]);
assert_eq!(arr[ RangeFrom::from(1.. )], [ 1, 2, 3, 4]);
assert_eq!(arr[ Range::from(1..3 )], [ 1, 2 ]);
assert_eq!(arr[RangeInclusive::from(1..=3)], [ 1, 2, 3 ]);start..end in a future edition).start..).RangeFrom iterator...).start..=last).RangeInclusive iterator.Range iterator...end)...=last).OneSidedRange is implemented for built-in range types that are unbounded on one side. For example, a.., ..b and ..=c implement OneSidedRange, but .., d..e, and f..=g do not.RangeBounds is implemented by Rust’s built-in range types, produced by range syntax like .., a.., ..b, ..=c, d..e, or f..=g.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/range/index.html