pub struct RangeFrom<Idx> {
pub start: Idx,
}
new_range_api
#125687)Expand description
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
:
Fieldsยง
ยงstart: Idx
new_range_api
#125687)The lower bound of the range (inclusive).
Implementationsยง
Sourceยงimpl<Idx> RangeFrom<Idx>where
Idx: Step,
impl<Idx> RangeFrom<Idx>where
Idx: Step,
Sourceยงimpl<Idx> RangeFrom<Idx>where
Idx: PartialOrd,
impl<Idx> RangeFrom<Idx>where
Idx: PartialOrd,
Sourcepub fn contains<U>(&self, item: &U) -> bool
๐ฌThis is a nightly-only experimental API. (new_range_api
#125687)
pub fn contains<U>(&self, item: &U) -> bool
new_range_api
#125687)Returns true
if item
is contained in the range.
ยงExamples
#![feature(new_range_api)]
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ยง
Sourceยงimpl<T> IntoBounds<T> for RangeFrom<T>
impl<T> IntoBounds<T> for RangeFrom<T>
Sourceยงimpl<A> IntoIterator for RangeFrom<A>where
A: Step,
impl<A> IntoIterator for RangeFrom<A>where
A: Step,
Sourceยงimpl<T> RangeBounds<T> for RangeFrom<&T>
impl<T> RangeBounds<T> for RangeFrom<&T>
Sourceยงimpl<T> RangeBounds<T> for RangeFrom<T>
impl<T> RangeBounds<T> for RangeFrom<T>
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
)Sourceยงimpl SliceIndex<str> for RangeFrom<usize>
impl SliceIndex<str> for RangeFrom<usize>
Sourceยงfn get(
self,
slice: &str,
) -> Option<&<RangeFrom<usize> as SliceIndex<str>>::Output>
fn get( self, slice: &str, ) -> Option<&<RangeFrom<usize> as SliceIndex<str>>::Output>
slice_index_methods
)Sourceยงfn get_mut(
self,
slice: &mut str,
) -> Option<&mut <RangeFrom<usize> as SliceIndex<str>>::Output>
fn get_mut( self, slice: &mut str, ) -> Option<&mut <RangeFrom<usize> as SliceIndex<str>>::Output>
slice_index_methods
)Sourceยงunsafe fn get_unchecked(
self,
slice: *const str,
) -> *const <RangeFrom<usize> as SliceIndex<str>>::Output
unsafe fn get_unchecked( self, slice: *const str, ) -> *const <RangeFrom<usize> as SliceIndex<str>>::Output
slice_index_methods
)Sourceยงunsafe fn get_unchecked_mut(
self,
slice: *mut str,
) -> *mut <RangeFrom<usize> as SliceIndex<str>>::Output
unsafe fn get_unchecked_mut( self, slice: *mut str, ) -> *mut <RangeFrom<usize> as SliceIndex<str>>::Output
slice_index_methods
)