Skip to content

[_]::windows needs better examples to avoid confusion #118571

Closed

Description

Location

https://doc.rust-lang.org/std/primitive.slice.html#method.windows

Summary

The documentation only shows an example with windows of size 2 and an example with windows of size 3, but the resulting slice is mutated and it woudl be hard to understand what exactly windows returns. For example, my previous assumption was that there was an overlap of only one element and not size - 1. An example with window size larger than 2 would help avoid this confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-docsArea: documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions