Trait iset::IndexType[][src]

pub trait IndexType: Copy + Display + Sized + Eq {
    const MAX: Self;

    fn get(self) -> usize;
fn new(element_num: usize) -> Result<Self, &'static str>; fn defined(self) -> bool { ... } }
Expand description

Trait for index types: used in the inner representation of IntervalMap and IntervalSet.

Implemented for u8, u16, u32, u64 and u128. DefaultIx is an alias for default index type (u32). IntervalMap or IntervalSet can store up to min(usize::MAX, Ix::MAX - 1) elements.

Using smaller index type saves memory usage and may reduce running time.

Associated Constants

Maximal possible value. Used for undefined indices.

Required methods

Converts index into usize.

Creates a new index. Returns error if the elemen_num is too big.

Provided methods

Returns true if the index is defined (not equal to Self::MAX).

Implementations on Foreign Types

Implementors