pub struct RangeFrom<Idx> {
pub start: Idx,
}Expand description
A range only bounded inclusively below.
The RangeFrom contains all values with x >= start.
Note: Overflow in the IntoIterator 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). Unlike
its legacy counterpart, the iterator will only panic after yielding the
maximum value when overflow checks are enabled.
§Examples
use core::range::RangeFrom;
assert_eq!(RangeFrom::from(2..), core::range::RangeFrom { start: 2 });
assert_eq!(2 + 3 + 4, RangeFrom::from(2..).into_iter().take(3).sum());§Edition notes
It is planned that the syntax start.. will construct this
type in a future edition, but it does not do so today.
Fields§
§start: IdxThe lower bound of the range (inclusive).
Implementations§
Source§impl<Idx: Step> RangeFrom<Idx>
impl<Idx: Step> RangeFrom<Idx>
1.96.0 · Sourcepub fn iter(&self) -> RangeFromIter<Idx> ⓘ
pub fn iter(&self) -> RangeFromIter<Idx> ⓘ
Creates an iterator over the elements within this range.
Shorthand for .clone().into_iter()
§Examples
Source§impl<Idx: PartialOrd<Idx>> RangeFrom<Idx>
impl<Idx: PartialOrd<Idx>> RangeFrom<Idx>
1.96.0 (const: unstable) · Sourcepub fn contains<U>(&self, item: &U) -> bool
pub fn contains<U>(&self, item: &U) -> bool
Returns true if item is contained in the range.
§Examples
use core::range::RangeFrom;
assert!(!RangeFrom::from(3..).contains(&2));
assert!( RangeFrom::from(3..).contains(&3));
assert!( RangeFrom::from(3..).contains(&1_000_000_000));
assert!( RangeFrom::from(0.0..).contains(&0.5));
assert!(!RangeFrom::from(0.0..).contains(&f32::NAN));
assert!(!RangeFrom::from(f32::NAN..).contains(&0.5));Trait Implementations§
impl<Idx: Copy> Copy for RangeFrom<Idx>
1.96.0 (const: unstable) · Source§impl<Idx: Eq> Eq for RangeFrom<Idx>
impl<Idx: Eq> Eq for RangeFrom<Idx>
Source§#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
derive_eq_internals)1.0.0 (const: unstable) · Source§#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
implementation detail of #[derive(Eq)]
Source§impl<T> IntoBounds<T> for RangeFrom<T>
impl<T> IntoBounds<T> for RangeFrom<T>
1.96.0 · Source§impl<A: Step> IntoIterator for RangeFrom<A>
impl<A: Step> IntoIterator for RangeFrom<A>
Source§impl<T> OneSidedRange<T> for RangeFrom<T>where
Self: RangeBounds<T>,
impl<T> OneSidedRange<T> for RangeFrom<T>where
Self: RangeBounds<T>,
Source§fn bound(self) -> (OneSidedRangeBound, T)
fn bound(self) -> (OneSidedRangeBound, T)
one_sided_range #69780)split_off and
split_off_mut that returns the bound of the one-sided range.1.96.0 (const: unstable) · Source§impl<T> RangeBounds<T> for RangeFrom<T>
impl<T> RangeBounds<T> for RangeFrom<T>
1.96.0 (const: unstable) · Source§impl<T> RangeBounds<T> for RangeFrom<&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.. with (Bound::Included(start), Bound::Unbounded).
impl<T> RangeBounds<T> for RangeFrom<&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.. with (Bound::Included(start), Bound::Unbounded).
Source§impl<T> RangeIntersect for RangeFrom<T>where
T: Ord,
impl<T> RangeIntersect for RangeFrom<T>where
T: Ord,
Source§type Intersection = RangeFrom<T>
type Intersection = RangeFrom<T>
range_intersect #165428)Source§fn intersect(self, rhs: Self) -> Self::Intersection
fn intersect(self, rhs: Self) -> Self::Intersection
range_intersect #165428)self and rhs.Source§impl<T> RangeIntersect<Range<T>> for RangeFrom<T>where
T: Ord,
impl<T> RangeIntersect<Range<T>> for RangeFrom<T>where
T: Ord,
Source§type Intersection = Range<T>
type Intersection = Range<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeFrom<T>> for Range<T>where
T: Ord,
impl<T> RangeIntersect<RangeFrom<T>> for Range<T>where
T: Ord,
Source§type Intersection = Range<T>
type Intersection = Range<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeFrom<T>> for RangeTo<T>
impl<T> RangeIntersect<RangeFrom<T>> for RangeTo<T>
Source§type Intersection = Range<T>
type Intersection = Range<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeFrom<T>> for RangeFull
impl<T> RangeIntersect<RangeFrom<T>> for RangeFull
Source§type Intersection = RangeFrom<T>
type Intersection = RangeFrom<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeFrom<T>> for RangeInclusive<T>where
T: Ord,
impl<T> RangeIntersect<RangeFrom<T>> for RangeInclusive<T>where
T: Ord,
Source§type Intersection = RangeInclusive<T>
type Intersection = RangeInclusive<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeFrom<T>> for RangeToInclusive<T>
impl<T> RangeIntersect<RangeFrom<T>> for RangeToInclusive<T>
Source§type Intersection = RangeInclusive<T>
type Intersection = RangeInclusive<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeFull> for RangeFrom<T>
impl<T> RangeIntersect<RangeFull> for RangeFrom<T>
Source§type Intersection = RangeFrom<T>
type Intersection = RangeFrom<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeInclusive<T>> for RangeFrom<T>where
T: Ord,
impl<T> RangeIntersect<RangeInclusive<T>> for RangeFrom<T>where
T: Ord,
Source§type Intersection = RangeInclusive<T>
type Intersection = RangeInclusive<T>
range_intersect #165428)Source§fn intersect(self, rhs: RangeInclusive<T>) -> Self::Intersection
fn intersect(self, rhs: RangeInclusive<T>) -> Self::Intersection
range_intersect #165428)self and rhs.Source§impl<T> RangeIntersect<RangeTo<T>> for RangeFrom<T>
impl<T> RangeIntersect<RangeTo<T>> for RangeFrom<T>
Source§type Intersection = Range<T>
type Intersection = Range<T>
range_intersect #165428)Source§impl<T> RangeIntersect<RangeToInclusive<T>> for RangeFrom<T>
impl<T> RangeIntersect<RangeToInclusive<T>> for RangeFrom<T>
Source§type Intersection = RangeInclusive<T>
type Intersection = RangeInclusive<T>
range_intersect #165428)Source§fn intersect(self, rhs: RangeToInclusive<T>) -> Self::Intersection
fn intersect(self, rhs: RangeToInclusive<T>) -> Self::Intersection
range_intersect #165428)self and rhs.Source§impl SliceIndex<ByteStr> for RangeFrom<usize>
impl SliceIndex<ByteStr> for RangeFrom<usize>
Source§fn get(self, slice: &ByteStr) -> Option<&Self::Output>
fn get(self, slice: &ByteStr) -> Option<&Self::Output>
slice_index_methods)Source§fn get_mut(self, slice: &mut ByteStr) -> Option<&mut Self::Output>
fn get_mut(self, slice: &mut ByteStr) -> Option<&mut Self::Output>
slice_index_methods)Source§unsafe fn get_unchecked(self, slice: *const ByteStr) -> *const Self::Output
unsafe fn get_unchecked(self, slice: *const ByteStr) -> *const Self::Output
slice_index_methods)Source§unsafe fn get_unchecked_mut(self, slice: *mut ByteStr) -> *mut Self::Output
unsafe fn get_unchecked_mut(self, slice: *mut ByteStr) -> *mut Self::Output
slice_index_methods)1.96.0 (const: unstable) · Source§impl<T> SliceIndex<[T]> for RangeFrom<usize>
impl<T> SliceIndex<[T]> for RangeFrom<usize>
Source§fn get(self, slice: &[T]) -> Option<&[T]>
fn get(self, slice: &[T]) -> Option<&[T]>
slice_index_methods)Source§fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
slice_index_methods)Source§unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
slice_index_methods)Source§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)1.96.0 (const: unstable) · Source§impl SliceIndex<str> for RangeFrom<usize>
impl SliceIndex<str> for RangeFrom<usize>
Source§fn get(self, slice: &str) -> Option<&Self::Output>
fn get(self, slice: &str) -> Option<&Self::Output>
slice_index_methods)Source§fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output>
fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output>
slice_index_methods)Source§unsafe fn get_unchecked(self, slice: *const str) -> *const Self::Output
unsafe fn get_unchecked(self, slice: *const str) -> *const Self::Output
slice_index_methods)Source§unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output
unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output
slice_index_methods)impl<Idx: PartialEq> StructuralPartialEq for RangeFrom<Idx>
Auto Trait Implementations§
impl<Idx> Forget for RangeFrom<Idx>
impl<Idx> Freeze for RangeFrom<Idx>where
Idx: Freeze,
impl<Idx> Move for RangeFrom<Idx>where
Idx: Move,
impl<Idx> RefUnwindSafe for RangeFrom<Idx>where
Idx: RefUnwindSafe,
impl<Idx> Send for RangeFrom<Idx>where
Idx: Send,
impl<Idx> Sync for RangeFrom<Idx>where
Idx: Sync,
impl<Idx> Unpin for RangeFrom<Idx>where
Idx: Unpin,
impl<Idx> UnsafeUnpin for RangeFrom<Idx>where
Idx: UnsafeUnpin,
impl<Idx> UnwindSafe for RangeFrom<Idx>where
Idx: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Printable for T
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize
#[doc(hidden)]const SIZE: usize
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize
#[doc(hidden)]const ALIGN: usize
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment
#[doc(hidden)]const ALIGNMENT: Alignment
sized_type_properties)Source§#[doc(hidden)]const IS_ZST: bool
#[doc(hidden)]const IS_ZST: bool
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout
#[doc(hidden)]const LAYOUT: Layout
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize
#[doc(hidden)]const MAX_SLICE_LEN: usize
sized_type_properties)[Self]. Read more