Hacker News new | past | comments | ask | show | jobs | submit login

There is a `windows` iterator.

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

However, your code would not work as-is, since the window borrows the buffer, so `buffer[i]` cannot be written to. Further, there is no `windows_mut` to let you write to the end of the window, because that would let you get multiple mutable references to a given element.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: