#array #iterator

no-std collect_array

Allows for collecting an Iterator into an exactly sized array

4 releases

0.1.3 Jun 9, 2021
0.1.2 Jun 9, 2021
0.1.1 May 30, 2021
0.1.0 Apr 6, 2021

#2471 in Rust patterns

Download history 15/week @ 2024-11-16 10/week @ 2024-11-23 44/week @ 2024-11-30 77/week @ 2024-12-07 108/week @ 2024-12-14 2/week @ 2024-12-28 12/week @ 2025-01-04 57/week @ 2025-01-11 20/week @ 2025-01-18 14/week @ 2025-01-25 37/week @ 2025-02-01 20/week @ 2025-02-08 36/week @ 2025-02-15 86/week @ 2025-02-22 55/week @ 2025-03-01

207 downloads per month

BSD-3-Clause

16KB
355 lines

collect_array

Allows for collecting an Iterator into an exactly sized array.

crates.io Documentation Build Status

Example

use collect_array::CollectArrayResult;

let result: CollectArrayResult<_, 2> = vec![1, 2].into_iter().collect();
assert_eq!(CollectArrayResult::Ok([1, 2]), result);

lib.rs:

Allows for collecting an Iterator into an exactly sized array.

Example

use collect_array::CollectArrayResult;

let v = vec![0, 1, 2];
let result: CollectArrayResult<_, 3> = v.into_iter().collect();
assert_eq!(CollectArrayResult::Ok([0, 1, 2]), result);

No runtime deps