pub struct RangeFull;
new_range_api #125687)
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.
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 ]);
impl Clone for RangeFull
fn clone(&self) -> RangeFull
fn clone_from(&mut self, source: &Self)
source. Read more
impl Debug for RangeFull
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>
impl Default for RangeFull
impl Distribution<bool> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> bool
random #130703)
impl Distribution<i128> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i128
random #130703)
impl Distribution<i16> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i16
random #130703)
impl Distribution<i32> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i32
random #130703)
impl Distribution<i64> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i64
random #130703)
impl Distribution<i8> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> i8
random #130703)
impl Distribution<isize> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> isize
random #130703)
impl Distribution<u128> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u128
random #130703)
impl Distribution<u16> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u16
random #130703)
impl Distribution<u32> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u32
random #130703)
impl Distribution<u64> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u64
random #130703)
impl Distribution<u8> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> u8
random #130703)
impl Distribution<usize> for RangeFull
fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> usize
random #130703)
impl Hash for RangeFull
fn hash<__H>(&self, state: &mut __H)where
__H: Hasher,fn hash_slice<H>(data: &[Self], state: &mut H)where
H: Hasher,
Self: Sized,impl Index<RangeFull> for ByteString
type Output = ByteStr
fn index(&self, _: RangeFull) -> &ByteStr
container[index]) operation. Read more
impl Index<RangeFull> for CString
type Output = CStr
fn index(&self, _index: RangeFull) -> &CStr
container[index]) operation. Read more
impl Index<RangeFull> for OsString
type Output = OsStr
fn index(&self, _index: RangeFull) -> &OsStr
container[index]) operation. Read more
impl IndexMut<RangeFull> for ByteString
fn index_mut(&mut self, _: RangeFull) -> &mut ByteStr
container[index]) operation. Read more
impl IndexMut<RangeFull> for OsString
fn index_mut(&mut self, _index: RangeFull) -> &mut OsStr
container[index]) operation. Read more
impl<T> IntoBounds<T> for RangeFull
fn into_bounds(self) -> (Bound<T>, Bound<T>)
range_into_bounds #136903)
(start_bound, end_bound). Read more
fn intersect<R>(self, other: R) -> (Bound<T>, Bound<T>)where
Self: Sized,
T: Ord,
R: IntoBounds<T>,range_into_bounds #136903)
impl PartialEq for RangeFull
fn eq(&self, other: &RangeFull) -> bool
self and other values to be equal, and is used by ==.fn ne(&self, other: &Rhs) -> bool
!=. The default implementation is almost always sufficient, and should not be overridden without very good reason.impl<T> RangeBounds<T> for RangeFullwhere
T: ?Sized,fn start_bound(&self) -> Bound<&T>
fn end_bound(&self) -> Bound<&T>
fn contains<U>(&self, item: &U) -> boolwhere
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,fn is_empty(&self) -> boolwhere
T: PartialOrd,range_bounds_is_empty #137300)
true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
impl<T> SliceIndex<[T]> for RangeFull
type Output = [T]
fn get(self, slice: &[T]) -> Option<&[T]>
slice_index_methods)
fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
slice_index_methods)
unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
slice_index_methods)
unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
slice_index_methods)
fn index(self, slice: &[T]) -> &[T]
slice_index_methods)
fn index_mut(self, slice: &mut [T]) -> &mut [T]
slice_index_methods)
impl SliceIndex<ByteStr> for RangeFull
type Output = ByteStr
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>slice_index_methods)
unsafe fn get_unchecked(
self,
slice: *const ByteStr,
) -> *const <RangeFull as SliceIndex<ByteStr>>::Outputslice_index_methods)
unsafe fn get_unchecked_mut(
self,
slice: *mut ByteStr,
) -> *mut <RangeFull as SliceIndex<ByteStr>>::Outputslice_index_methods)
fn index(self, slice: &ByteStr) -> &<RangeFull as SliceIndex<ByteStr>>::Output
slice_index_methods)
fn index_mut(
self,
slice: &mut ByteStr,
) -> &mut <RangeFull as SliceIndex<ByteStr>>::Outputslice_index_methods)
impl SliceIndex<str> for RangeFullImplements 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].
type Output = str
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>slice_index_methods)
unsafe fn get_unchecked(
self,
slice: *const str,
) -> *const <RangeFull as SliceIndex<str>>::Outputslice_index_methods)
unsafe fn get_unchecked_mut(
self,
slice: *mut str,
) -> *mut <RangeFull as SliceIndex<str>>::Outputslice_index_methods)
fn index(self, slice: &str) -> &<RangeFull as SliceIndex<str>>::Output
slice_index_methods)
fn index_mut(
self,
slice: &mut str,
) -> &mut <RangeFull as SliceIndex<str>>::Outputslice_index_methods)
impl Copy for RangeFull
impl Eq for RangeFull
impl StructuralPartialEq for RangeFull
impl Freeze for RangeFull
impl RefUnwindSafe for RangeFull
impl Send for RangeFull
impl Sync for RangeFull
impl Unpin for RangeFull
impl UnwindSafe for RangeFull
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> CloneToUninit for Twhere
T: Clone,unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit #126799)
impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T> ToOwned for Twhere
T: Clone,type Owned = T
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
Β© 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/struct.RangeFull.html