You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
JohnTheCoolingFan
added
the
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
label
Dec 3, 2023
JohnTheCoolingFan
changed the title
[_]::windows needs better examples ro vaoid confusion[_]::windows needs better examples to avoid confusion
Dec 3, 2023
saethlin
added
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Dec 4, 2023
Rollup merge of rust-lang#118586 - gurry:118571-improve-slice-doc-example, r=thomcc
Improve example in `slice::windows()` doc
Fixesrust-lang#118571
Now using a window of 3 instead 2 because it removes any confusion about exactly how consecutive windows overlap
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.
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 size3
, but the resulting slice is mutated and it woudl be hard to understand what exactlywindows
returns. For example, my previous assumption was that there was an overlap of only one element and notsize - 1
. An example with window size larger than 2 would help avoid this confusion.The text was updated successfully, but these errors were encountered: