pub trait IdMapCollectionKey {
    const VARIANT_COUNT: NonZeroUsize;

    // Required methods
    fn get_variant(&self) -> usize;
    fn get_id(&self) -> usize;
Expand description

A key that can index items in IdMapCollection.

An IdMapCollectionKey is a key with two levels: variant and id. The number of variants must be fixed and known at compile time, and is typically mapped to a number of enum variants (nested or not).

Required Associated Constants§


const VARIANT_COUNT: NonZeroUsize

The number of variants this key supports.

Required Methods§


fn get_variant(&self) -> usize

Get the variant index for this key.


Callers may assume that get_variant returns a value in the range [0, VARIANT_COUNT), and may panic if that assumption is violated.


fn get_id(&self) -> usize

Get the id index for this key.