#iterator #iterator-adapter #chunks #no-std

no-std iterchunks

An iterator adapter to adapter that yields N elements of the iterator at a time

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

#1831 in Algorithms

Download history 9/week @ 2024-01-28 37/week @ 2024-02-18 55/week @ 2024-02-25 15/week @ 2024-03-03 33/week @ 2024-03-10 34/week @ 2024-03-17 20/week @ 2024-03-24 119/week @ 2024-03-31 81/week @ 2024-04-07 63/week @ 2024-04-14 32/week @ 2024-04-21 1/week @ 2024-04-28 7/week @ 2024-05-05

107 downloads per month

MIT/Apache

71KB
1K SLoC

iterchunks

Crates.io Version Docs.rs Latest Build Status

This crate provides an iterator adapter that yields N elements of the iterator at a time.

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_chunks"] }

Getting started

Add the crate to your Cargo manifest.

cargo add iterchunks

And bring the IterArrayChunks trait into scope.

use iterchunks::IterArrayChunks;

Now you can use the array_chunks method on any iterator.

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

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

let c = iter.array_chunks::<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