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§

source

const VARIANT_COUNT: NonZeroUsize

The number of variants this key supports.

Required Methods§

source

fn get_variant(&self) -> usize

Get the variant index for this key.

Panics

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

source

fn get_id(&self) -> usize

Get the id index for this key.

Implementors§