Skip to main content

RangeInclusive

Struct RangeInclusive 

1.95.0 · Source
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: Idx

The lower bound of the range (inclusive).

§last: Idx

The upper bound of the range (inclusive).

Implementations§

Source§

impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx>

1.95.0 (const: unstable) · Source

pub fn contains<U>(&self, item: &U) -> bool
where Idx: PartialOrd<U>, U: ?Sized + PartialOrd<Idx>,

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) · Source

pub fn is_empty(&self) -> bool
where 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:

use core::range::RangeInclusive;

assert!(!RangeInclusive::from(3.0..=5.0).is_empty());
assert!( RangeInclusive::from(3.0..=f32::NAN).is_empty());
assert!( RangeInclusive::from(f32::NAN..=5.0).is_empty());
Source§

impl<Idx: Step> RangeInclusive<Idx>

1.95.0 · Source

pub fn iter(&self) -> RangeInclusiveIter<Idx>

Creates an iterator over the elements within this range.

Shorthand for .clone().into_iter()

§Examples
use core::range::RangeInclusive;

let mut i = RangeInclusive::from(3..=8).iter().map(|n| n*n);
assert_eq!(i.next(), Some(9));
assert_eq!(i.next(), Some(16));
assert_eq!(i.next(), Some(25));

Trait Implementations§

1.95.0 · Source§

impl<Idx: Clone> Clone for RangeInclusive<Idx>

Source§

fn clone(&self) -> RangeInclusive<Idx>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)
where Self:,

Performs copy-assignment from source. Read more
1.95.0 · Source§

impl<Idx: Copy> Copy for RangeInclusive<Idx>

1.95.0 · Source§

impl<Idx: Debug> Debug for RangeInclusive<Idx>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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)

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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i16

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i32

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i64

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> i128

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> isize

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u8

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u16

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u32

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u64

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> u128

🔬This is a nightly-only experimental API. (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>

Source§

fn sample(&self, source: &mut (impl Rng + ?Sized)) -> usize

🔬This is a nightly-only experimental API. (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!");
}
1.95.0 · Source§

impl<Idx: Eq> Eq for RangeInclusive<Idx>

1.95.0 (const: unstable) · Source§

impl<T> From<RangeInclusive<T>> for RangeInclusive<T>

Source§

fn from(value: RangeInclusive<T>) -> Self

Converts to this type from the input type.
1.95.0 (const: unstable) · Source§

impl<T> From<RangeInclusive<T>> for RangeInclusive<T>

Source§

fn from(value: RangeInclusive<T>) -> Self

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>

Source§

fn is_in_bounds(&self, len: usize) -> bool

🔬This is a nightly-only experimental API. (get_disjoint_mut_helpers)
Returns true if self is in bounds for len slice elements.
Source§

fn is_overlapping(&self, other: &Self) -> bool

🔬This is a nightly-only experimental API. (get_disjoint_mut_helpers)
Returns true if self overlaps with other. Read more
1.95.0 · Source§

impl<Idx: Hash> Hash for RangeInclusive<Idx>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H: Hasher>(data: &[Self], state: &mut H)
where Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> IntoBounds<T> for RangeInclusive<T>

Source§

fn into_bounds(self) -> (Bound<T>, Bound<T>)

🔬This is a nightly-only experimental API. (range_into_bounds #136903)
Convert this range into the start and end bounds. Returns (start_bound, end_bound). Read more
Source§

fn intersect<R>(self, other: R) -> (Bound<T>, Bound<T>)
where Self: Sized, T: Ord, R: Sized + IntoBounds<T>,

🔬This is a nightly-only experimental API. (range_into_bounds #136903)
Compute the intersection of self and other. Read more
1.95.0 · Source§

impl<A: Step> IntoIterator for RangeInclusive<A>

Source§

type Item = A

The type of the elements being iterated over.
Source§

type IntoIter = RangeInclusiveIter<A>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
1.95.0 · Source§

impl<Idx: PartialEq> PartialEq for RangeInclusive<Idx>

Source§

fn eq(&self, other: &RangeInclusive<Idx>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
1.95.0 (const: unstable) · Source§

impl<T> RangeBounds<T> for RangeInclusive<T>

Source§

fn start_bound(&self) -> Bound<&T>

Start index bound. Read more
Source§

fn end_bound(&self) -> Bound<&T>

End index bound. Read more
1.35.0 (const: unstable) · Source§

fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>, U: ?Sized + PartialOrd<T>,

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty #137300)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
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)).

Source§

fn start_bound(&self) -> Bound<&T>

Start index bound. Read more
Source§

fn end_bound(&self) -> Bound<&T>

End index bound. Read more
1.35.0 (const: unstable) · Source§

fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>, U: ?Sized + PartialOrd<T>,

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty #137300)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
Source§

impl SliceIndex<ByteStr> for RangeInclusive<usize>

Source§

type Output = ByteStr

The output type returned by methods.
Source§

fn get(self, slice: &ByteStr) -> Option<&Self::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Source§

fn get_mut(self, slice: &mut ByteStr) -> Option<&mut Self::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Source§

unsafe fn get_unchecked(self, slice: *const ByteStr) -> *const Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Source§

unsafe fn get_unchecked_mut(self, slice: *mut ByteStr) -> *mut Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Source§

fn index(self, slice: &ByteStr) -> &Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Source§

fn index_mut(self, slice: &mut ByteStr) -> &mut Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
1.95.0 (const: unstable) · Source§

impl<T> SliceIndex<[T]> for RangeInclusive<usize>

Source§

type Output = [T]

The output type returned by methods.
Source§

fn get(self, slice: &[T]) -> Option<&[T]>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Source§

fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Source§

unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Source§

unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Source§

fn index(self, slice: &[T]) -> &[T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Source§

fn index_mut(self, slice: &mut [T]) -> &mut [T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
1.95.0 (const: unstable) · Source§

impl SliceIndex<str> for RangeInclusive<usize>

Source§

type Output = str

The output type returned by methods.
Source§

fn get(self, slice: &str) -> Option<&Self::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Source§

fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Source§

unsafe fn get_unchecked(self, slice: *const str) -> *const Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Source§

unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Source§

fn index(self, slice: &str) -> &Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Source§

fn index_mut(self, slice: &mut str) -> &mut Self::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
1.95.0 · Source§

impl<Idx: PartialEq> StructuralPartialEq for RangeInclusive<Idx>

Auto Trait Implementations§

§

impl<Idx> Freeze for RangeInclusive<Idx>
where Idx: Freeze,

§

impl<Idx> RefUnwindSafe for RangeInclusive<Idx>
where Idx: RefUnwindSafe,

§

impl<Idx> Send for RangeInclusive<Idx>
where Idx: Send,

§

impl<Idx> Sync for RangeInclusive<Idx>
where Idx: Sync,

§

impl<Idx> Unpin for RangeInclusive<Idx>
where Idx: Unpin,

§

impl<Idx> UnsafeUnpin for RangeInclusive<Idx>
where Idx: UnsafeUnpin,

§

impl<Idx> UnwindSafe for RangeInclusive<Idx>
where Idx: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.