Type Alias mozjs::jsapi::JS::AutoRooterListHeads

source ยท
pub type AutoRooterListHeads = [u64; 3];
Expand description

EnumeratedArray is a fixed-size array container for use when an array is indexed by a specific enum class.

This provides type safety by guarding at compile time against accidentally indexing such arrays with unrelated values. This also removes the need for manual casting when using a typed enum value to index arrays.

Aside from the typing of indices, EnumeratedArray is similar to Array.

Example:

enum class AnimalSpecies { Cow, Sheep, Count };

EnumeratedArray<AnimalSpecies, int, AnimalSpecies::Count> headCount;

headCount[AnimalSpecies::Cow] = 17; headCount[AnimalSpecies::Sheep] = 30;

If the enum class has contiguous values and provides a specialization of mozilla::MaxContiguousEnumValue then the size will be calculated as the max value + 1.