#iterator #iterator-adapter #no-std #windows

no-std iterwindows

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

7 releases (4 breaking)

0.5.0 Nov 28, 2023
0.4.0 Nov 28, 2023
0.3.0 Dec 4, 2022
0.2.0 Dec 1, 2022
0.1.2 Nov 29, 2022

#1149 in Algorithms

Download history 32/week @ 2024-03-14 17/week @ 2024-03-21 56/week @ 2024-03-28 40/week @ 2024-04-04 30/week @ 2024-04-11 51/week @ 2024-04-18 26/week @ 2024-04-25 22/week @ 2024-05-02 40/week @ 2024-05-09 70/week @ 2024-05-16 15/week @ 2024-05-23 24/week @ 2024-05-30 1389/week @ 2024-06-06 1789/week @ 2024-06-13 2303/week @ 2024-06-20 2895/week @ 2024-06-27

8,379 downloads per month

MIT/Apache

71KB
1K SLoC

iterwindows

Crates.io Version Docs.rs Latest Build Status

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

Deprecated

This crate is deprecated in favour of the itermore crate and it currently just re-exports types from there. The following dependency definition is the equivalent of using this crate.

# Cargo.toml

[dependencies]
itermore = { version = "...", default-features = false, features = ["array_windows"] }

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