owned_chunks

Crates.ioowned_chunks
lib.rsowned_chunks
version0.1.1
sourcesrc
created_at2021-11-21 18:21:14.092257
updated_at2022-01-12 16:38:30.539908
descriptiona collection of traits and iterators to get owned chunks from collections
homepagehttps://github.com/Clueliss/owned_chunks
repository
max_upload_size
id485394
size27,165
Liss Heidrich (Clueliss)

documentation

README

owned_chunks

A collection of iterators and traits that allow you to get owned chunks from collections (currently Vec and array)

Example

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

Commit count: 0

cargo fmt