pub trait IndexType:
Copy
+ Display
+ Sized
+ Eq
+ Ord {
const MAX: Self;
// Required methods
fn get(self) -> usize;
fn new(element_num: usize) -> Result<Self, &'static str>;
// Provided method
fn defined(self) -> bool { ... }
}
Expand description
Trait for index types: used in the inner representation of IntervalMap and IntervalSet.
Implemented for u8
, u16
, u32
and u64
,
u32
is used by default (DefaultIx).
IntervalMap
or IntervalSet
can store up to Ix::MAX - 1
elements
(for example IntervalMap<_, _, u8>
can store up to 255 items).
Using smaller index types saves memory and slightly reduces running time.
Required Associated Constants§
Required Methods§
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.