pub struct RangeInclusive<Idx> {
pub start: Idx,
pub last: Idx,
}Expand description
A range bounded inclusively below and above.
The RangeInclusive contains all values with x >= start
and x <= last. It is empty unless start <= last.
ยงExamples
use core::range::RangeInclusive;
assert_eq!(RangeInclusive::from(3..=5), RangeInclusive { start: 3, last: 5 });
assert_eq!(3 + 4 + 5, RangeInclusive::from(3..=5).into_iter().sum());ยงEdition notes
It is planned that the syntax start..=last will construct this
type in a future edition, but it does not do so today.
Fieldsยง
ยงstart: IdxThe lower bound of the range (inclusive).
last: IdxThe upper bound of the range (inclusive).
Implementationsยง
Sourceยงimpl<Idx> RangeInclusive<Idx>where
Idx: PartialOrd,
impl<Idx> RangeInclusive<Idx>where
Idx: PartialOrd,
1.95.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::RangeInclusive;
assert!(!RangeInclusive::from(3..=5).contains(&2));
assert!( RangeInclusive::from(3..=5).contains(&3));
assert!( RangeInclusive::from(3..=5).contains(&4));
assert!( RangeInclusive::from(3..=5).contains(&5));
assert!(!RangeInclusive::from(3..=5).contains(&6));
assert!( RangeInclusive::from(3..=3).contains(&3));
assert!(!RangeInclusive::from(3..=2).contains(&3));
assert!( RangeInclusive::from(0.0..=1.0).contains(&1.0));
assert!(!RangeInclusive::from(0.0..=1.0).contains(&f32::NAN));
assert!(!RangeInclusive::from(0.0..=f32::NAN).contains(&0.0));
assert!(!RangeInclusive::from(f32::NAN..=1.0).contains(&1.0));1.95.0 (const: unstable) ยท Sourcepub fn is_empty(&self) -> boolwhere
Idx: PartialOrd,
pub fn is_empty(&self) -> boolwhere
Idx: PartialOrd,
Returns true if the range contains no items.
ยงExamples
use core::range::RangeInclusive;
assert!(!RangeInclusive::from(3..=5).is_empty());
assert!(!RangeInclusive::from(3..=3).is_empty());
assert!( RangeInclusive::from(3..=2).is_empty());The range is empty if either side is incomparable:
Sourceยงimpl<Idx> RangeInclusive<Idx>where
Idx: Step,
impl<Idx> RangeInclusive<Idx>where
Idx: Step,
1.95.0 ยท Sourcepub fn iter(&self) -> RangeInclusiveIter<Idx> โ
pub fn iter(&self) -> RangeInclusiveIter<Idx> โ
Creates an iterator over the elements within this range.
Shorthand for .clone().into_iter()
ยงExamples
Trait Implementationsยง
1.95.0 ยท Sourceยงimpl<Idx> Clone for RangeInclusive<Idx>where
Idx: Clone,
impl<Idx> Clone for RangeInclusive<Idx>where
Idx: Clone,
Sourceยงfn clone(&self) -> RangeInclusive<Idx>
fn clone(&self) -> RangeInclusive<Idx>
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<Idx> Copy for RangeInclusive<Idx>where
Idx: Copy,
1.95.0 ยท Sourceยงimpl<Idx> Debug for RangeInclusive<Idx>where
Idx: Debug,
impl<Idx> Debug for RangeInclusive<Idx>where
Idx: Debug,
Sourceยงimpl Distribution<i8> for RangeInclusive<i8>
impl Distribution<i8> for RangeInclusive<i8>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> i8
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i8
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<i16> for RangeInclusive<i16>
impl Distribution<i16> for RangeInclusive<i16>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> i16
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i16
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<i32> for RangeInclusive<i32>
impl Distribution<i32> for RangeInclusive<i32>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> i32
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i32
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<i64> for RangeInclusive<i64>
impl Distribution<i64> for RangeInclusive<i64>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> i64
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i64
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<i128> for RangeInclusive<i128>
impl Distribution<i128> for RangeInclusive<i128>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> i128
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i128
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<isize> for RangeInclusive<isize>
impl Distribution<isize> for RangeInclusive<isize>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> isize
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> isize
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<u8> for RangeInclusive<u8>
impl Distribution<u8> for RangeInclusive<u8>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> u8
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u8
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<u16> for RangeInclusive<u16>
impl Distribution<u16> for RangeInclusive<u16>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> u16
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u16
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<u32> for RangeInclusive<u32>
impl Distribution<u32> for RangeInclusive<u32>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> u32
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u32
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<u64> for RangeInclusive<u64>
impl Distribution<u64> for RangeInclusive<u64>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> u64
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u64
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<u128> for RangeInclusive<u128>
impl Distribution<u128> for RangeInclusive<u128>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> u128
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u128
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}Sourceยงimpl Distribution<usize> for RangeInclusive<usize>
impl Distribution<usize> for RangeInclusive<usize>
Sourceยงfn sample(&self, source: &mut (impl Rng + ?Sized)) -> usize
๐ฌThis is a nightly-only experimental API. (random #130703)
fn sample(&self, source: &mut (impl Rng + ?Sized)) -> usize
random #130703)Chooses a random number within the range.
Every possible result value is equally likely. In other words, this operation uses unbiased uniform sampling.
ยงPanics
Panics if the range is empty.
ยงSide-channels
This implementation does not claim to be resistant against side- channel attacks. In particular, the execution time of this operation may leak information about the returned value, and not just the values of the range bounds. While this implementation tries to avoid operations with particularly data-dependent timing (such as divisions), Rust as a language has no facilities for ensuring data-independent timing, voiding all promises about side-channel- freedom.
ยงExamples
A D20 dice roll:
#![feature(random)]
use std::random::{Distribution, SystemRng};
use std::range::RangeInclusive;
let roll = RangeInclusive::from(1..=20).sample(&mut SystemRng);
assert!(1 <= roll && roll <= 20);
if roll == 20 {
println!("Wow! You achieve writing a sound linked list.");
} else {
println!("Miri attacks!");
}impl<Idx> Eq for RangeInclusive<Idx>where
Idx: Eq,
1.95.0 (const: unstable) ยท Sourceยงimpl<T> From<RangeInclusive<T>> for RangeInclusive<T>
impl<T> From<RangeInclusive<T>> for RangeInclusive<T>
Sourceยงfn from(value: RangeInclusive<T>) -> RangeInclusive<T> โ
fn from(value: RangeInclusive<T>) -> RangeInclusive<T> โ
1.95.0 (const: unstable) ยท Sourceยงimpl<T> From<RangeInclusive<T>> for RangeInclusive<T>
impl<T> From<RangeInclusive<T>> for RangeInclusive<T>
Sourceยงfn from(value: RangeInclusive<T>) -> RangeInclusive<T>
fn from(value: RangeInclusive<T>) -> RangeInclusive<T>
Converts from a legacy range to a non-legacy range, potentially panicking.
ยงPanics
If the legacy range iterator has been exhausted, this function will either panic or return an empty range.
ยงExamples
use core::range::legacy;
use core::range::RangeInclusive;
let single: legacy::RangeInclusive<i32> = 0..=1;
let single = RangeInclusive::from(single);
assert_eq!((single.start, single.last), (0, 1));
let empty: legacy::RangeInclusive<i32> = 0..=0;
let empty = RangeInclusive::from(empty);
assert_eq!((empty.start, empty.last), (0, 0));use core::range::legacy;
use core::range::RangeInclusive;
use std::panic::catch_unwind;
let mut exhausted: legacy::RangeInclusive<i32> = 0..=0;
exhausted.next();
let result = catch_unwind(|| RangeInclusive::from(exhausted));
// The `from` call either panicked or returned an empty range.
assert!(result.is_err() || result.is_ok_and(|range| range.is_empty()));Sourceยงimpl GetDisjointMutIndex for RangeInclusive<usize>
impl GetDisjointMutIndex for RangeInclusive<usize>
Sourceยงfn is_in_bounds(&self, len: usize) -> bool
fn is_in_bounds(&self, len: usize) -> bool
get_disjoint_mut_helpers)true if self is in bounds for len slice elements.Sourceยงfn is_overlapping(&self, other: &RangeInclusive<usize>) -> bool
fn is_overlapping(&self, other: &RangeInclusive<usize>) -> bool
get_disjoint_mut_helpers)1.95.0 ยท Sourceยงimpl<Idx> Hash for RangeInclusive<Idx>where
Idx: Hash,
impl<Idx> Hash for RangeInclusive<Idx>where
Idx: Hash,
Sourceยงimpl<T> IntoBounds<T> for RangeInclusive<T>
impl<T> IntoBounds<T> for RangeInclusive<T>
1.95.0 ยท Sourceยงimpl<A> IntoIterator for RangeInclusive<A>where
A: Step,
impl<A> IntoIterator for RangeInclusive<A>where
A: Step,
Sourceยงtype IntoIter = RangeInclusiveIter<A>
type IntoIter = RangeInclusiveIter<A>
Sourceยงfn into_iter(self) -> <RangeInclusive<A> as IntoIterator>::IntoIter
fn into_iter(self) -> <RangeInclusive<A> as IntoIterator>::IntoIter
1.95.0 ยท Sourceยงimpl<Idx> PartialEq for RangeInclusive<Idx>where
Idx: PartialEq,
impl<Idx> PartialEq for RangeInclusive<Idx>where
Idx: PartialEq,
1.95.0 (const: unstable) ยท Sourceยงimpl<T> RangeBounds<T> for RangeInclusive<T>
impl<T> RangeBounds<T> for RangeInclusive<T>
1.95.0 (const: unstable) ยท Sourceยงimpl<T> RangeBounds<T> for RangeInclusive<&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..=end with (Bound::Included(start), Bound::Included(end)).
impl<T> RangeBounds<T> for RangeInclusive<&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..=end with (Bound::Included(start), Bound::Included(end)).
Sourceยงimpl SliceIndex<ByteStr> for RangeInclusive<usize>
impl SliceIndex<ByteStr> for RangeInclusive<usize>
Sourceยงfn get(
self,
slice: &ByteStr,
) -> Option<&<RangeInclusive<usize> as SliceIndex<ByteStr>>::Output>
fn get( self, slice: &ByteStr, ) -> Option<&<RangeInclusive<usize> as SliceIndex<ByteStr>>::Output>
slice_index_methods)Sourceยงfn get_mut(
self,
slice: &mut ByteStr,
) -> Option<&mut <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output>
fn get_mut( self, slice: &mut ByteStr, ) -> Option<&mut <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output>
slice_index_methods)Sourceยงunsafe fn get_unchecked(
self,
slice: *const ByteStr,
) -> *const <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
unsafe fn get_unchecked( self, slice: *const ByteStr, ) -> *const <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
slice_index_methods)Sourceยงunsafe fn get_unchecked_mut(
self,
slice: *mut ByteStr,
) -> *mut <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
unsafe fn get_unchecked_mut( self, slice: *mut ByteStr, ) -> *mut <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
slice_index_methods)Sourceยงfn index(
self,
slice: &ByteStr,
) -> &<RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
fn index( self, slice: &ByteStr, ) -> &<RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
slice_index_methods)Sourceยงfn index_mut(
self,
slice: &mut ByteStr,
) -> &mut <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
fn index_mut( self, slice: &mut ByteStr, ) -> &mut <RangeInclusive<usize> as SliceIndex<ByteStr>>::Output
slice_index_methods)1.95.0 (const: unstable) ยท Sourceยงimpl<T> SliceIndex<[T]> for RangeInclusive<usize>
impl<T> SliceIndex<[T]> for RangeInclusive<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.95.0 (const: unstable) ยท Sourceยงimpl SliceIndex<str> for RangeInclusive<usize>
impl SliceIndex<str> for RangeInclusive<usize>
Sourceยงfn get(
self,
slice: &str,
) -> Option<&<RangeInclusive<usize> as SliceIndex<str>>::Output>
fn get( self, slice: &str, ) -> Option<&<RangeInclusive<usize> as SliceIndex<str>>::Output>
slice_index_methods)Sourceยงfn get_mut(
self,
slice: &mut str,
) -> Option<&mut <RangeInclusive<usize> as SliceIndex<str>>::Output>
fn get_mut( self, slice: &mut str, ) -> Option<&mut <RangeInclusive<usize> as SliceIndex<str>>::Output>
slice_index_methods)Sourceยงunsafe fn get_unchecked(
self,
slice: *const str,
) -> *const <RangeInclusive<usize> as SliceIndex<str>>::Output
unsafe fn get_unchecked( self, slice: *const str, ) -> *const <RangeInclusive<usize> as SliceIndex<str>>::Output
slice_index_methods)Sourceยงunsafe fn get_unchecked_mut(
self,
slice: *mut str,
) -> *mut <RangeInclusive<usize> as SliceIndex<str>>::Output
unsafe fn get_unchecked_mut( self, slice: *mut str, ) -> *mut <RangeInclusive<usize> as SliceIndex<str>>::Output
slice_index_methods)Sourceยงfn index(
self,
slice: &str,
) -> &<RangeInclusive<usize> as SliceIndex<str>>::Output
fn index( self, slice: &str, ) -> &<RangeInclusive<usize> as SliceIndex<str>>::Output
slice_index_methods)Sourceยงfn index_mut(
self,
slice: &mut str,
) -> &mut <RangeInclusive<usize> as SliceIndex<str>>::Output
fn index_mut( self, slice: &mut str, ) -> &mut <RangeInclusive<usize> as SliceIndex<str>>::Output
slice_index_methods)