Struct RangeFull

pub struct RangeFull;

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 Clone for RangeFull

fn clone(&self) -> RangeFull

impl Copy for RangeFull

impl Debug for RangeFull

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

impl Default for RangeFull

fn default() -> RangeFull

impl Distribution<bool> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> bool

impl Distribution<i128> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> i128

impl Distribution<i16> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> i16

impl Distribution<i32> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> i32

impl Distribution<i64> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> i64

impl Distribution<i8> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> i8

impl Distribution<isize> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> isize

impl Distribution<u128> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> u128

impl Distribution<u16> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> u16

impl Distribution<u32> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> u32

impl Distribution<u64> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> u64

impl Distribution<u8> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> u8

impl Distribution<usize> for RangeFull

fn sample(&self, source: &mut impl Rng + ?Sized) -> usize

impl Eq for RangeFull

fn assert_fields_are_eq(&self)

impl Hash for RangeFull

fn hash<__H: Hasher>(&self, state: &mut __H)

impl PartialEq for RangeFull

fn eq(&self, other: &RangeFull) -> bool

impl SliceIndex<ByteStr> for RangeFull

type Output = ByteStr;
fn get(self, slice: &ByteStr) -> Option<&Self::Output>
fn get_mut(self, slice: &mut ByteStr) -> Option<&mut Self::Output>
unsafe fn get_unchecked(self, slice: *const ByteStr) -> *const Self::Output
unsafe fn get_unchecked_mut(self, slice: *mut ByteStr) -> *mut Self::Output
fn index(self, slice: &ByteStr) -> &Self::Output
fn index_mut(self, slice: &mut ByteStr) -> &mut Self::Output

impl SliceIndex<str> for RangeFull

type Output = str;
fn get(self, slice: &str) -> Option<&Self::Output>
fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output>
unsafe fn get_unchecked(self, slice: *const str) -> *const Self::Output
unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output
fn index(self, slice: &str) -> &Self::Output
fn index_mut(self, slice: &mut str) -> &mut Self::Output

impl StructuralPartialEq for RangeFull

impl TrivialClone for RangeFull

impl<T> IntoBounds<T> for RangeFull

fn into_bounds(self) -> (Bound<T>, Bound<T>)

impl<T> SliceIndex<[T]> for RangeFull

type Output = [T];
fn get(self, slice: &[T]) -> Option<&[T]>
fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
fn index(self, slice: &[T]) -> &[T]
fn index_mut(self, slice: &mut [T]) -> &mut [T]

impl<T: ?Sized> RangeBounds<T> for RangeFull

fn start_bound(&self) -> Bound<&T>
fn end_bound(&self) -> Bound<&T>

Auto Trait Implementations

impl Freeze for RangeFull

impl RefUnwindSafe for RangeFull

impl Send for RangeFull

impl Sync for RangeFull

impl Unpin for RangeFull

impl UnsafeUnpin for RangeFull

impl UnwindSafe for RangeFull

Blanket Implementations

impl<T> Any for RangeFull where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for RangeFull where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for RangeFull where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for RangeFull where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for RangeFull

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Printable for RangeFull where T: Copy + Debug,

impl<T> SizeHint for RangeFull where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for RangeFull

impl<T, U> Into<U> for RangeFull where 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, U> TryFrom<U> for RangeFull where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for RangeFull where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>