#array #iterator #collecting #sized #collect #exactly

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

#2327 in Rust patterns

Download history 3/week @ 2023-11-20 66/week @ 2023-11-27 66/week @ 2023-12-04 7/week @ 2023-12-11 44/week @ 2023-12-18 1/week @ 2023-12-25 30/week @ 2024-01-01 35/week @ 2024-01-08 2/week @ 2024-01-22 19/week @ 2024-02-19 46/week @ 2024-02-26 44/week @ 2024-03-04

109 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