Crates.io | owned_chunks |
lib.rs | owned_chunks |
version | 0.1.1 |
source | src |
created_at | 2021-11-21 18:21:14.092257 |
updated_at | 2022-01-12 16:38:30.539908 |
description | a collection of traits and iterators to get owned chunks from collections |
homepage | https://github.com/Clueliss/owned_chunks |
repository | |
max_upload_size | |
id | 485394 |
size | 27,165 |
A collection of iterators and traits that allow you to get owned chunks
from collections
(currently Vec
and array
)
use owned_chunks::OwnedChunks;
fn take_ownership(v: Vec<i32>) {
// implementation
}
for (ix, chunk) in vec![vec![1, 2], vec![3, 4], vec![5, 6]].owned_chunks(2).enumerate() {
match ix {
0 => assert_eq!(&[vec![1, 2], vec![3, 4]], chunk.as_slice()),
1 => assert_eq!(&[vec![5, 6]], chunk.as_slice()),
_ => panic!("no more chunks expected"),
}
for vec in chunk {
take_ownership(vec);
}
}
License: GPL-2.0-or-later