Expand description
§Replacement range types
The types within this module are meant to replace the legacy Range,
RangeInclusive, RangeToInclusive and RangeFrom types in a future edition.
use core::range::{Range, RangeFrom, RangeInclusive, RangeToInclusive};
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[RangeToInclusive::from( ..=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 ]);Re-exports§
use crate::fmt;🔒use crate::hash::Hash;🔒use crate::hash::Hash;🔒use crate::marker::Destruct;🔒Experimental use core::ops::Bound;🔒use core::ops::Bound::Excluded;🔒use core::ops::Bound::Included;🔒use core::ops::Bound::Unbounded;🔒use crate::iter::Step;🔒Experimental use crate::ops::IntoBounds;🔒Experimental use crate::ops::OneSidedRange;🔒Experimental use crate::ops::OneSidedRangeBound;🔒Experimental use crate::ops::RangeBounds;🔒
Modules§
Structs§
- Range
- A (half-open) range bounded inclusively below and exclusively above.
- Range
From - A range only bounded inclusively below.
- Range
From Iter - By-value
RangeFromiterator. - Range
Full - An unbounded range (
..). - Range
Inclusive - A range bounded inclusively below and above.
- Range
Inclusive Iter - By-value
RangeInclusiveiterator. - Range
Iter - By-value
Rangeiterator. - RangeTo
- A range only bounded exclusively above (
..end). - Range
ToInclusive - A range only bounded inclusively above.
Traits§
- Range
Intersect Experimental - Computes the intersection of two ranges, returning the most specific range type possible.