Re:Making Rust a Better Fit for Cheri and Other Platforms
by Ar-Curunir on Thursday April 14, 2022 @09:51AM
(#31026992)
> _ it even lets you declare an array whose index is some enumerated type._
You can do this in Rust also: make a custom newtype wrapper for your array, and impl Index<CustomEnum> for the wrapped array.
If I have an array representing a single-byte lookup table, it would be nice if I could say that the array's type is array-indexed-by-u8 rather than array-indexed-by-usize.
Ada did this well: it even lets you declare an array whose index is some enumerated type.