std::ops::RangeInclusive

Enum std::ops::RangeInclusive

pub enum RangeInclusive<Idx> {
    Empty {
        at: Idx,
    },
    NonEmpty {
        start: Idx,
        end: Idx,
    },
}
???? This is a nightly-only experimental API. (inclusive_range #28237)recently added, follows RFC

An inclusive range which is bounded at both ends: { x | start <= x <= end }. Use start...end (three dots) for its shorthand.

See the contains method for its characterization.

Examples

#![feature(inclusive_range,inclusive_range_syntax)]
fn main() {
    assert_eq!((3...5), std::ops::RangeInclusive::NonEmpty{ start: 3, end: 5 });
    assert_eq!(3+4+5, (3...5).sum());

    let arr = [0, 1, 2, 3];
    assert_eq!(arr[