#arrayvec #generic #generic-array #stack #vec #generics

no-std generic-arrayvec

Interop between the arrayvec and generic_array crates

7 releases (4 breaking)

0.4.0 Jul 27, 2022
0.3.1 Aug 6, 2021
0.3.0 May 20, 2020
0.2.0 May 1, 2019
0.0.2 Jul 15, 2018

#2107 in Data structures

MIT/Apache

19KB
281 lines

generic-arrayvec

Build status

This crate provides interop between the arrayvec v0.5 and generic_array crates, allowing you to use generic_array's GenericArray datatype as the backing storage for the data structures in arrayvec. This lets you have vector and string types that store their contents inline, with a capacity that can be referred to in generic code.

Note that as of its v0.6 release, arrayvec uses Rust's const generics feature to implement functionality similar to this crate but with better ergonomics, so you may not need this crate anymore. Still, const generics currently has some limitations on stable Rust which the approach this crate uses does not, so this crate can still be useful. Also, this crate can be a bit more memory efficient due to its vectors storing their length using 1 byte when capacity < 2^8, 2 bytes when capacity < 2^16, etc; in comparison arrayvec as of v0.7.2 always uses 4 bytes for this.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~260–460KB
~11K SLoC