Struct wasmtime_environ::__core::range::RangeFrom
source · pub struct RangeFrom<Idx> {
pub start: Idx,
}
new_range_api
)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
:
#![feature(new_range_api)]
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());
Fields§
§start: Idx
new_range_api
)The lower bound of the range (inclusive).
Implementations§
source§impl<Idx> RangeFrom<Idx>where
Idx: Step,
impl<Idx> RangeFrom<Idx>where
Idx: Step,
sourcepub fn iter(&self) -> IterRangeFrom<Idx> ⓘ
🔬This is a nightly-only experimental API. (new_range_api
)
pub fn iter(&self) -> IterRangeFrom<Idx> ⓘ
new_range_api
)Create an iterator over the elements within this range.
Shorthand for .clone().into_iter()
§Examples
#![feature(new_range_api)]
use core::range::RangeFrom;
let mut i = RangeFrom::from(3..).iter().map(|n| n*n);
assert_eq!(i.next(), Some(9));
assert_eq!(i.next(), Some(16));
assert_eq!(i.next(), Some(25));
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
)
pub fn contains<U>(&self, item: &U) -> bool
new_range_api
)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> IntoIterator for RangeFrom<A>where
A: Step,
impl<A> IntoIterator for RangeFrom<A>where
A: Step,
source§impl<Idx> PartialEq for RangeFrom<Idx>where
Idx: PartialEq,
impl<Idx> PartialEq for RangeFrom<Idx>where
Idx: PartialEq,
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
)slice
pointer
is undefined behavior even if the resulting pointer is not used.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
)slice
pointer
is undefined behavior even if the resulting pointer is not used.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
)slice
pointer
is undefined behavior even if the resulting pointer is not used.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
)slice
pointer
is undefined behavior even if the resulting pointer is not used.impl<Idx> Copy for RangeFrom<Idx>where
Idx: Copy,
impl<Idx> Eq for RangeFrom<Idx>where
Idx: Eq,
impl<Idx> StructuralPartialEq for RangeFrom<Idx>
Auto Trait Implementations§
impl<Idx> Freeze for RangeFrom<Idx>where
Idx: Freeze,
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> 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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.