If you are holding indexes to a collection and plan to delete elements you will never use Vec.
There are dedicated data structures for this [1] that will not let you access another item by mistake.
There are dedicated data structures for this [1] that will not let you access another item by mistake.
One of my favorite alternatives is generational_arena [0] which also happens to be the library that inspired Vale's generational references!
[0] https://docs.rs/generational-arena/latest/generational_arena...