Implement Index and IndexMut traits for ArrayVec - #191
Conversation
niluxv
commented
Jul 15, 2021
Instead of this implementation ( self.deref().index[_mut](index)Maybe that gives better error messages in some situations? I don't know... |
bluss
commented
Jul 19, 2021
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
5b111f5Compareniluxv
commented
Jul 24, 2021
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
niluxv
commented
Aug 29, 2021
So I changed the trait bounds as you suggested and just now added implementations to |
mikwielgus
commented
Jul 15, 2026
Hello, may I ask what is the status of this PR? I see that this was approved but not merged, is there anything stalling this beyond merge conflict resolution? It would be convenient for me to have |
I didn't have time to add tests to it yet, but this should implement
Index<I>andIndexMut<I>whereI: SliceIndex<[T]>.Fixes#190