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)