#no-std #iterator #windows

no-std iterwindows

An iterator adapter to iterate over all contiguous windows of length N

5 unstable releases

0.3.0 Dec 4, 2022
0.2.0 Dec 1, 2022
0.1.2 Nov 29, 2022
0.1.1 Nov 28, 2022
0.1.0 Nov 27, 2022

#1734 in Rust patterns

Download history 24/week @ 2023-02-10 17/week @ 2023-02-17 6/week @ 2023-02-24 12/week @ 2023-03-03 1/week @ 2023-03-10 4/week @ 2023-03-17 18/week @ 2023-03-24 27/week @ 2023-03-31 23/week @ 2023-04-07 9/week @ 2023-04-14 6/week @ 2023-04-28 10/week @ 2023-05-05 3/week @ 2023-05-12 16/week @ 2023-05-19 129/week @ 2023-05-26

270 downloads per month
Used in itermore

MIT/Apache

15KB
128 lines

iterwindows

Crates.io Version Docs.rs Latest Build Status

This crate provides an iterator adapter to iterate over all contiguous windows of length N.

Getting started

Add the crate to your Cargo manifest.

cargo add iterwindows

And bring the IterArrayWindows trait into scope.

use iterwindows::IterArrayWindows;

Now you can use the array_windows method on any iterator.

for [a, b, c] in iter.array_windows() {
    println!("{} {} {}", a, b, c)
}

Generally the size of N can be inferred by the compiler but you can also specify it manually.

let w = iter.array_windows::<3>();

License

This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Dependencies