dense_map::collection

Trait DenseMapCollectionKey

Source
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 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.

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.

Implementors§