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, AnimalSpecies::Count, int> headCount;

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

Trait Implementations§

source§

impl<T: Traceable, const COUNT: usize> Traceable for [T; COUNT]

source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.