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: Step> RangeFrom<Idx>
impl<Idx: Step> RangeFrom<Idx>
Source§impl<Idx: PartialOrd<Idx>> RangeFrom<Idx>
impl<Idx: PartialOrd<Idx>> RangeFrom<Idx>
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<A: Step> IntoIterator for RangeFrom<A>
impl<A: Step> IntoIterator for RangeFrom<A>
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<&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
)