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 variant
s must be fixed and known at compile time, and is
typically mapped to a number of enum
variants (nested or not).
Required Associated Constants§
sourceconst VARIANT_COUNT: NonZeroUsize
const VARIANT_COUNT: NonZeroUsize
The number of variants this key supports.
Required Methods§
sourcefn get_variant(&self) -> usize
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.