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§

source

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.

source

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.

Implementations on Foreign Types§

source§

impl Key for NonZeroU32

Implementors§