method iter.windows
Sliding windows of n consecutive elements (none if there are fewer than n).
Example:
fn main() io {
print("{[1, 2, 3, 4].iter().windows(3).collect()}")
}Output
[[1, 2, 3], [2, 3, 4]]
pub(api) move fn windows<I>(n: I) -> iter<List<T>>Complexity. O(n * size); each window is a new list.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
n | I |
Returns
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/iter.oxl:424