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()}")
}Вывод
[[1, 2, 3], [2, 3, 4]]
pub(api) move fn windows<I>(n: I) -> iter<List<T>>Сложность. O(n * size); each window is a new list.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
n | I |
Возвращает
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/iter.oxl:424