Struct RangeFrom

struct RangeFrom<Idx> { ... }

A range only bounded inclusively below (start..).

The RangeFrom start.. contains all values with x >= start.

Note: Overflow in the Iterator implementation (when the contained data type reaches its numerical limit) is allowed to panic, wrap, or saturate. This behavior is defined by the implementation of the Step trait. For primitive integers, this follows the normal rules, and respects the overflow checks profile (panic in debug, wrap in release). Note also that overflow happens earlier than you might assume: the overflow happens in the call to next that yields the maximum value, as the range must be set to a state to yield the next value.

Examples

The start.. syntax is a RangeFrom:

assert_eq!((2..), std::ops::RangeFrom { start: 2 });
assert_eq!(2 + 3 + 4, (2..).take(3).sum());
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[ ..=3], [0, 1, 2, 3   ]);
assert_eq!(arr[1..  ], [   1, 2, 3, 4]); // This is a `RangeFrom`
assert_eq!(arr[1.. 3], [   1, 2      ]);
assert_eq!(arr[1..=3], [   1, 2, 3   ]);

Fields

start: Idx

The lower bound of the range (inclusive).

Implementations

impl<Idx: PartialOrd<Idx>> RangeFrom<Idx>

const fn contains<U>(self: &Self, item: &U) -> bool
where
    Idx: ~const PartialOrd<U>,
    U: ?Sized + ~const PartialOrd<Idx>

Returns true if item is contained in the range.

Examples

assert!(!(3..).contains(&2));
assert!( (3..).contains(&3));
assert!( (3..).contains(&1_000_000_000));

assert!( (0.0..).contains(&0.5));
assert!(!(0.0..).contains(&f32::NAN));
assert!(!(f32::NAN..).contains(&0.5));

impl SliceIndex for RangeFrom<usize>

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

impl SliceIndex for RangeFrom<usize>

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

impl<A: Step> FusedIterator for RangeFrom<A>

impl<A: Step> Iterator for RangeFrom<A>

fn next(self: &mut Self) -> Option<A>
fn size_hint(self: &Self) -> (usize, Option<usize>)
fn nth(self: &mut Self, n: usize) -> Option<A>

impl<A: TrustedStep> TrustedLen for RangeFrom<A>

impl<I> IntoIterator for RangeFrom<Idx>

fn into_iter(self: Self) -> I

impl<Idx> Freeze for RangeFrom<Idx>

impl<Idx> RefUnwindSafe for RangeFrom<Idx>

impl<Idx> Send for RangeFrom<Idx>

impl<Idx> StructuralPartialEq for RangeFrom<Idx>

impl<Idx> Sync for RangeFrom<Idx>

impl<Idx> Unpin for RangeFrom<Idx>

impl<Idx> UnsafeUnpin for RangeFrom<Idx>

impl<Idx> UnwindSafe for RangeFrom<Idx>

impl<Idx: $crate::cmp::Eq> Eq for RangeFrom<Idx>

impl<Idx: $crate::hash::Hash> Hash for RangeFrom<Idx>

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

impl<Idx: fmt::Debug> Debug for RangeFrom<Idx>

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

impl<Idx: ~const $crate::clone::Clone> Clone for RangeFrom<Idx>

fn clone(self: &Self) -> RangeFrom<Idx>

impl<Idx: ~const $crate::cmp::PartialEq> PartialEq for RangeFrom<Idx>

fn eq(self: &Self, other: &RangeFrom<Idx>) -> bool

impl<T> Any for RangeFrom<Idx>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for RangeFrom<Idx>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for RangeFrom<Idx>

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

impl<T> CloneToUninit for RangeFrom<Idx>

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

impl<T> From for RangeFrom<Idx>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> From for RangeFrom<T>

fn from(value: RangeFrom<T>) -> Self

impl<T> IntoBounds for RangeFrom<T>

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

impl<T> OneSidedRange for RangeFrom<T>

fn bound(self: Self) -> (OneSidedRangeBound, T)

impl<T> RangeBounds for RangeFrom<&T>

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

impl<T> RangeBounds for RangeFrom<T>

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

impl<T> SliceIndex for RangeFrom<usize>

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

impl<T, U> Into for RangeFrom<Idx>

fn into(self: 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 for RangeFrom<Idx>

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

impl<T, U> TryInto for RangeFrom<Idx>

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