pub trait StaticIndex: 'static + Index<Size = ()> {
const ALL: &'static [Self];
// Required method
fn to_usize(self) -> usize;
// Provided method
fn from_usize(index: usize) -> Self { ... }
}Expand description
Implemented by types that can be used as an index for an Array and
where the size of the Array is a compile-time constant.
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn from_usize(index: usize) -> Self
fn from_usize(index: usize) -> Self
Equivalent to, but often more efficient than, ALL[index].
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.