-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Index
and IndexMut
traits for ArrayVec
#191
base: master
Are you sure you want to change the base?
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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