build-array

Crates.iobuild-array
lib.rsbuild-array
version0.1.2
sourcesrc
created_at2024-06-21 21:24:33.390536
updated_at2024-06-26 00:30:06.690561
descriptionBuild an array dynamically without heap allocations.
homepagehttps://crates.io/crates/build-array
repositoryhttps://github.com/aatifsyed/build-array
max_upload_size
id1279983
size9,357
Aatif Syed (aatifsyed)

documentation

https://docs.rs/build-array

README

Build an array dynamically without heap allocations, deferring errors to a single build callsite.

let arr: [u8; 3] = ArrayBuilder::new()
    .push(1)
    .push(2)
    .push(3)
    .build_exact()
    .unwrap();

assert_eq!(arr, [1, 2, 3]);

You can choose how to handle the wrong number of push calls:

Comparison with other libraries

  • [arrayvec] requires you to handle over-provision at each call to try_push.
  • array_builder will [panic!] on over-provision.
Commit count: 16

cargo fmt