[][src]Trait typed_index_collections::Index

pub trait Index {
    fn from_usize(index: usize) -> Self;
fn into_usize(self) -> usize; }

A trait for TiSlice and TiVec indeces.

If default feature impl-index-from is enabled, this trait is automatically implemented when From<usize> and Into<usize> are implemented. And their implementation can be easily done with derive_more crate and #[derive(From, Into)].

Required methods

fn from_usize(index: usize) -> Self

Construct an Index from a usize.

fn into_usize(self) -> usize

Get the underlying index.

Loading content...

Implementors

impl<T> Index for T where
    T: From<usize>,
    usize: From<T>, 
[src]

The Index trait is automatically implemented for types which implement From<usize> and Into<usize> only when impl-index-from feature is enabled.

With default-features = false you can opt-out of the From and Into implementation which in some cases is not desirable.

Loading content...