Struct RangeFull
pub struct RangeFull;new_range_api)Expand description
An unbounded range (..).
RangeFull is primarily used as a slicing index, its shorthand is ...
It cannot serve as an Iterator because it doesnโt have a starting point.
ยงExamples
The .. syntax is a RangeFull:
assert_eq!(.., std::ops::RangeFull);It does not have an IntoIterator implementation, so you canโt use it in
a for loop directly. This wonโt compile:
for i in .. {
// ...
}Used as a slicing index, RangeFull produces the full array as a slice.
let arr = [0, 1, 2, 3, 4];
assert_eq!(arr[ .. ], [0, 1, 2, 3, 4]); // This is the `RangeFull`
assert_eq!(arr[ .. 3], [0, 1, 2 ]);
assert_eq!(arr[ ..=3], [0, 1, 2, 3 ]);
assert_eq!(arr[1.. ], [ 1, 2, 3, 4]);
assert_eq!(arr[1.. 3], [ 1, 2 ]);
assert_eq!(arr[1..=3], [ 1, 2, 3 ]);Trait Implementationsยง
ยงimpl Distribution<bool> for RangeFull
impl Distribution<bool> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> bool
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> bool
random)ยงimpl Distribution<i128> for RangeFull
impl Distribution<i128> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i128
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i128
random)ยงimpl Distribution<i16> for RangeFull
impl Distribution<i16> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i16
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i16
random)ยงimpl Distribution<i32> for RangeFull
impl Distribution<i32> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i32
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i32
random)ยงimpl Distribution<i64> for RangeFull
impl Distribution<i64> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i64
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i64
random)ยงimpl Distribution<i8> for RangeFull
impl Distribution<i8> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i8
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i8
random)ยงimpl Distribution<isize> for RangeFull
impl Distribution<isize> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> isize
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> isize
random)ยงimpl Distribution<u128> for RangeFull
impl Distribution<u128> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u128
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u128
random)ยงimpl Distribution<u16> for RangeFull
impl Distribution<u16> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u16
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u16
random)ยงimpl Distribution<u32> for RangeFull
impl Distribution<u32> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u32
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u32
random)ยงimpl Distribution<u64> for RangeFull
impl Distribution<u64> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u64
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u64
random)ยงimpl Distribution<u8> for RangeFull
impl Distribution<u8> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u8
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u8
random)ยงimpl Distribution<usize> for RangeFull
impl Distribution<usize> for RangeFull
ยงfn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> usize
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> usize
random)ยงimpl Index<RangeFull> for ByteString
impl Index<RangeFull> for ByteString
ยงimpl IndexMut<RangeFull> for ByteString
impl IndexMut<RangeFull> for ByteString
ยงimpl<T> IntoBounds<T> for RangeFull
impl<T> IntoBounds<T> for RangeFull
ยงfn into_bounds(self) -> (Bound<T>, Bound<T>)
fn into_bounds(self) -> (Bound<T>, Bound<T>)
range_into_bounds)(start_bound, end_bound). Read more1.28.0 (const: unstable)ยงimpl<T> RangeBounds<T> for RangeFullwhere
T: ?Sized,
impl<T> RangeBounds<T> for RangeFullwhere
T: ?Sized,
ยงfn start_bound(&self) -> Bound<&T>
fn start_bound(&self) -> Bound<&T>
ยงfn is_empty(&self) -> boolwhere
T: PartialOrd,
fn is_empty(&self) -> boolwhere
T: PartialOrd,
range_bounds_is_empty)true if the range contains no items.
One-sided ranges (RangeFrom, etc) always return false. Read more1.15.0 (const: unstable)ยงimpl<T> SliceIndex<[T]> for RangeFull
impl<T> SliceIndex<[T]> for RangeFull
ยงfn get(self, slice: &[T]) -> Option<&[T]>
fn get(self, slice: &[T]) -> Option<&[T]>
slice_index_methods)ยงfn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
slice_index_methods)ยงunsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
slice_index_methods)ยงunsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
slice_index_methods)ยงimpl SliceIndex<ByteStr> for RangeFull
impl SliceIndex<ByteStr> for RangeFull
ยงfn get(
self,
slice: &ByteStr,
) -> Option<&<RangeFull as SliceIndex<ByteStr>>::Output>
fn get( self, slice: &ByteStr, ) -> Option<&<RangeFull as SliceIndex<ByteStr>>::Output>
slice_index_methods)ยงfn get_mut(
self,
slice: &mut ByteStr,
) -> Option<&mut <RangeFull as SliceIndex<ByteStr>>::Output>
fn get_mut( self, slice: &mut ByteStr, ) -> Option<&mut <RangeFull as SliceIndex<ByteStr>>::Output>
slice_index_methods)ยงunsafe fn get_unchecked(
self,
slice: *const ByteStr,
) -> *const <RangeFull as SliceIndex<ByteStr>>::Output
unsafe fn get_unchecked( self, slice: *const ByteStr, ) -> *const <RangeFull as SliceIndex<ByteStr>>::Output
slice_index_methods)ยงunsafe fn get_unchecked_mut(
self,
slice: *mut ByteStr,
) -> *mut <RangeFull as SliceIndex<ByteStr>>::Output
unsafe fn get_unchecked_mut( self, slice: *mut ByteStr, ) -> *mut <RangeFull as SliceIndex<ByteStr>>::Output
slice_index_methods)1.20.0 (const: unstable)ยงimpl SliceIndex<str> for RangeFull
Implements substring slicing with syntax &self[..] or &mut self[..].
impl SliceIndex<str> for RangeFull
Implements substring slicing with syntax &self[..] or &mut self[..].
Returns a slice of the whole string, i.e., returns &self or &mut self. Equivalent to &self[0 .. len] or &mut self[0 .. len]. Unlike
other indexing operations, this can never panic.
This operation is O(1).
Prior to 1.20.0, these indexing operations were still supported by
direct implementation of Index and IndexMut.
Equivalent to &self[0 .. len] or &mut self[0 .. len].
ยงfn get(self, slice: &str) -> Option<&<RangeFull as SliceIndex<str>>::Output>
fn get(self, slice: &str) -> Option<&<RangeFull as SliceIndex<str>>::Output>
slice_index_methods)ยงfn get_mut(
self,
slice: &mut str,
) -> Option<&mut <RangeFull as SliceIndex<str>>::Output>
fn get_mut( self, slice: &mut str, ) -> Option<&mut <RangeFull as SliceIndex<str>>::Output>
slice_index_methods)ยงunsafe fn get_unchecked(
self,
slice: *const str,
) -> *const <RangeFull as SliceIndex<str>>::Output
unsafe fn get_unchecked( self, slice: *const str, ) -> *const <RangeFull as SliceIndex<str>>::Output
slice_index_methods)ยงunsafe fn get_unchecked_mut(
self,
slice: *mut str,
) -> *mut <RangeFull as SliceIndex<str>>::Output
unsafe fn get_unchecked_mut( self, slice: *mut str, ) -> *mut <RangeFull as SliceIndex<str>>::Output
slice_index_methods)impl Copy for RangeFull
impl Eq for RangeFull
impl StructuralPartialEq for RangeFull
Auto Trait Implementationsยง
impl Freeze for RangeFull
impl RefUnwindSafe for RangeFull
impl Send for RangeFull
impl Sync for RangeFull
impl Unpin for RangeFull
impl UnwindSafe for RangeFull
Blanket Implementationsยง
ยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
ยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
ยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงunsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.