Skip to content

Index and IndexMut documentation could be improved #36329

Closed
@Cobrand

Description

@Cobrand

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions