#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

#2504 in Rust patterns

Download history 19/week @ 2024-07-27 14/week @ 2024-08-03 34/week @ 2024-08-10 12/week @ 2024-08-17 19/week @ 2024-08-24 54/week @ 2024-08-31 4/week @ 2024-09-07 40/week @ 2024-09-14 33/week @ 2024-09-21 24/week @ 2024-09-28 20/week @ 2024-10-05 35/week @ 2024-10-12 50/week @ 2024-10-19 28/week @ 2024-10-26 37/week @ 2024-11-02 38/week @ 2024-11-09

164 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