pub struct Range<Idx> {
pub start: Idx,
pub end: Idx,
}Expand description
A (half-open) range bounded inclusively below and exclusively above
(start..end).
The range start..end contains all values with start <= x < end.
It is empty if start >= end.
§Examples
The start..end syntax is a Range:
Fields§
§start: IdxThe lower bound of the range (inclusive).
end: IdxThe upper bound of the range (exclusive).
Trait Implementations§
Source§impl<T> IntoBounds<T> for Range<T>
impl<T> IntoBounds<T> for Range<T>
1.28.0 (const: unstable) · Source§impl<T> RangeBounds<T> for Range<&T>
If you need to use this implementation where T is unsized,
consider using the RangeBounds impl for a 2-tuple of Bound<&T>,
i.e. replace start..end with (Bound::Included(start), Bound::Excluded(end)).
impl<T> RangeBounds<T> for Range<&T>
If you need to use this implementation where T is unsized,
consider using the RangeBounds impl for a 2-tuple of Bound<&T>,
i.e. replace start..end with (Bound::Included(start), Bound::Excluded(end)).
1.28.0 (const: unstable) · Source§impl<T> RangeBounds<T> for Range<T>
impl<T> RangeBounds<T> for Range<T>
1.15.0 (const: unstable) · Source§impl<T> SliceIndex<[T]> for Range<usize>
The methods index and index_mut panic if:
impl<T> SliceIndex<[T]> for Range<usize>
The methods index and index_mut panic if:
- the start of the range is greater than the end of the range or
- the end of the range is out of bounds.
Source§fn get(self, slice: &[T]) -> Option<&[T]>
fn get(self, slice: &[T]) -> Option<&[T]>
🔬This is a nightly-only experimental API. (
slice_index_methods)Returns a shared reference to the output at this location, if in
bounds.
Source§fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
🔬This is a nightly-only experimental API. (
slice_index_methods)Returns a mutable reference to the output at this location, if in
bounds.
Source§unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
🔬This is a nightly-only experimental API. (
slice_index_methods)Returns a pointer to the output at this location, without
performing any bounds checking. Read more
Source§unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
🔬This is a nightly-only experimental API. (
slice_index_methods)Returns a mutable pointer to the output at this location, without
performing any bounds checking. Read more