Trait texcraft_stdext::collections::interner::Key
source · pub trait Key: Copy + Eq {
// Required methods
fn try_from_usize(index: usize) -> Option<Self>;
fn into_usize(self) -> usize;
}
Expand description
Types implementing this trait can be used as keys in the Interner.
Required Methods§
sourcefn try_from_usize(index: usize) -> Option<Self>
fn try_from_usize(index: usize) -> Option<Self>
Try to create a key from the provided usize. The first usize passed to this method will be 0; the second 1; and so on.
This method is more or less the same as the well-known TryFrom<usize>
trait.
We use a custom trait so that consumers don’t have to implement the well-known trait.
sourcefn into_usize(self) -> usize
fn into_usize(self) -> usize
Convert the key into a usize.
This method is more or less the same as the well-known Into<usize>
trait.
We use a custom trait so that consumers don’t have to implement the well-known trait.