I have a MapTrait<T> which has an implementation fn data() which returns &[T]. T: Sized + Default + Clone + Copy
Is it possible to extend this function down here to make it accept a single value as well as a range?
As in std rust for slices?
Thus returning a single value or slice.
then I can use them in all other functions, instead of having to write the data() and data_mut() functions everywhere (for both single values as sub-slices)
I made this and it works with that 'static added to the generic T constraints. (the mut and unchecked versions as well).
I believe the 'static is needed because it is implemented in the trait itself.
Is that crazy or wrong?
Which brought me to the next question.
It would be really cool if this x,y, indexing was "traited"
Now I have separate get versions for
Like, you want everything SliceIndex gets you, but also some more? That's doable, but trait overlap checks are probably going to add some limitations. Like, if you want a blanket implementation for the things that work with SliceIndex<[T]>, everything else that implements it will have to be a local type. Or, you have to write all those usize and range implementations yourself (via macro probably) instead of using a blanket implementation.