Re:Making Rust a Better Fit for Cheri and Other Platforms
by bestouff on Thursday April 14, 2022 @05:34AM
(#31024821)
You could use TiVec[1], TiSlice[1] or TiBitset[2] (shameless plug) to have datastructures indexed by the type you need, all checked at compile type.
All you need is a From/Into implementation for your chosen index type.
1: https://lib.rs/crates/typed-index-collections
2: https://lib.rs/crates/tibitset