Implement Index and IndexMut traits for ArrayVec#191
Implement Index and IndexMut traits for ArrayVec#191niluxv wants to merge 5 commits intobluss:masterfrom
Index and IndexMut traits for ArrayVec#191Conversation
|
Instead of this implementation ( self.deref().index[_mut](index)Maybe that gives better error messages in some situations? I don't know... |
|
Looks to be in the right direction, that's nice - I'll be a bit unreachable during the summer, but back in a bit |
df06b9d to
5b111f5
Compare
|
No problem. I changed the implementation as described above because it indeed gives much better error messages on out of bounds errors, and added some tests. |
bluss
left a comment
There was a problem hiding this comment.
Thanks, yes not regressing the panic messages is certainly a requirement. One could also debate if I: SliceIndex or if [T]: Index<I> is the trait bound we should use (the latter being yet more general), but it seems fine as it is now.
We need the corresponding change for ArrayString too, but it can be a different PR.
|
So I changed the trait bounds as you suggested and just now added implementations to |
I didn't have time to add tests to it yet, but this should implement
Index<I>andIndexMut<I>whereI: SliceIndex<[T]>.Fixes #190