pub trait Index:
Copy
+ Clone
+ Debug
+ Display
+ Into<usize>
+ PartialEq
+ Eq
+ PartialOrd
+ Ord
+ Send
+ Sync
+ Sized
+ 'static {
const ZERO: Self;
const MAX_USIZE: usize;
// Required methods
fn from_usize(val: usize) -> Self;
fn try_from_usize(val: usize) -> Option<Self>;
fn saturating_add(self, val: usize) -> Self;
fn saturating_sub(self, val: usize) -> Self;
fn saturating_mul(self, val: usize) -> Self;
// Provided method
fn to_usize(self) -> usize { ... }
}
Expand description
Types which may be used to index and define the length and capacity of collections.
Required Associated Constants§
Required Methods§
Sourcefn from_usize(val: usize) -> Self
fn from_usize(val: usize) -> Self
Create an instance of this type from a usize, panicking if the bounds are exceeded
Sourcefn try_from_usize(val: usize) -> Option<Self>
fn try_from_usize(val: usize) -> Option<Self>
Try to create an instance of this type from a usize
Sourcefn saturating_add(self, val: usize) -> Self
fn saturating_add(self, val: usize) -> Self
Add a usize
without exceeding the bounds of this type
Sourcefn saturating_sub(self, val: usize) -> Self
fn saturating_sub(self, val: usize) -> Self
Subtract a usize
without exceeding the bounds of this type
Sourcefn saturating_mul(self, val: usize) -> Self
fn saturating_mul(self, val: usize) -> Self
Multiply by a usize
without exceeding the bounds of this type
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.