Closed
Description
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 not v.index(x)
; that allows things like v[x] = 5
).
Index<usize>
is implemented for lots of trivial types (str, String, Vec, ...), but nothing is said about Index<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.