Crates.io | iterchunks |
lib.rs | iterchunks |
version | 0.5.0 |
source | src |
created_at | 2022-11-27 13:21:20.914892 |
updated_at | 2023-11-28 22:01:59.510099 |
description | An iterator adapter to adapter that yields N elements of the iterator at a time |
homepage | |
repository | https://github.com/rossmacarthur/itermore |
max_upload_size | |
id | 723735 |
size | 17,001 |
This crate provides an iterator adapter that yields N elements of the iterator at a time.
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"] }
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>();
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.