iterwindows

Crates.ioiterwindows
lib.rsiterwindows
version0.5.0
sourcesrc
created_at2022-11-27 12:37:48.588069
updated_at2023-11-28 22:01:28.164324
descriptionAn iterator adapter to iterate over all contiguous windows of length N
homepage
repositoryhttps://github.com/rossmacarthur/itermore
max_upload_size
id723712
size17,136
Ross MacArthur (rossmacarthur)

documentation

README

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.

Commit count: 74

cargo fmt