slotmap
slotmap copied to clipboard
Feature Request: Allow viewing a `DenseSlotMap` as a slice of `T`s
DenseSlotMap
is already documented to store all values contiguously, so an AsRef<[T]>
and AsMut<[T]>
impl could be added to it to allow the user to actually access that contiguous storage. (an as_slice
and as_mut_slice
method that do the same thing would also be nice, to match what libstd containers do)
The motivation is simply that some algorithms may already be defined to operate on slices, and rewriting them to take an impl IntoIterator
would add too much churn and/or no longer guarantee optimizations the slice version would receive (and having them take the DenseSlotMap
or its iterator directly would cause needless API pollution with random types from dependencies). A good example is the salva library, which currently defines its own contiguous arena type.