pub trait DenseMapCollectionKey {
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 DenseMapCollection
.
A DenseMapCollectionKey
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.