-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Index and IndexMut documentation could be improved #36329
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
Comments
Hi @Cobrand I would like to work in this =D |
@marti1125 Then go ahead 👍 ! |
@Cobrand I don't know how to start =/ |
Well, I could help of course, but I think you are mistaken about me; I'm not a mentor or anything, just a perfectly average contributor, so my help will be quite limited: I wouldn't like to lead you the wrong way. I guess you could start by writing in pure english what I've described up there, and minimum requirement would be :
Again sorry if I misled you, I'm not a mentor in any way |
I actually think this means that you have a great deal of ability to help; often, more experienced contributors won't realize that an explanation is too advanced, or that something is missing. All of these seem like great improvements to me. |
@marti1125 do you still want to work on this ? |
improve docs for Index and IndexMut This mainly changes the boring example of Foo/Bar of `IndexMut` into a better one. Also added explanations about syntactic sugar for `v[index]`. Closes rust-lang#36329
Index and IndexMut are definitely lacking in explanations.
For starters, nothing says what does
v[x]
do exactly. (spoilers : it's sugar for*v.index(x)
and*v.index_mut(x)
and notv.index(x)
; that allows things likev[x] = 5
).Index<usize>
is implemented for lots of trivial types (str, String, Vec, ...), but nothing is said aboutIndex<Range...>
, and I think it would be worth showing some examples.I'm opening this, but I'm planning to open a PR next week fixing this, unless someone else is up for it of course.
The text was updated successfully, but these errors were encountered: