Trait indexical::ToIndex

source ·
pub trait ToIndex<T: IndexedValue, M> {
    // Required method
    fn to_index(self, domain: &IndexedDomain<T>) -> T::Index;
}
Expand description

Implicit conversions from elements to indexes. Commonly used in the IndexSet and IndexMatrix interfaces.

Note that we cannot use the Into trait because this conversion requires the IndexedDomain as input.

The M type parameter is a coherence hack to ensure the two blanket implementations do not conflict.

Required Methods§

source

fn to_index(self, domain: &IndexedDomain<T>) -> T::Index

Converts self to an index over T.

Implementations on Foreign Types§

source§

impl<'a, T: IndexedValue> ToIndex<T, MarkerRef> for &'a T

source§

fn to_index(self, domain: &IndexedDomain<T>) -> T::Index

Implementors§