Announcing hybrid-array
v0.2 - a generic array crate built on both const generics and typenum
:
- repo: GitHub - RustCrypto/hybrid-array: Hybrid typenum/const generic arrays
- crate: crates.io: Rust Package Registry
Rust's stable const generics support is still lacking two important features which mean they can't be fully used to replace crates like generic-array
.
- #60551: Associated constants in traits can not be used in const generics
- #76560: Complex generic constants:
feature(generic_const_exprs)
The hybrid-array
crate is designed from the ground up to combine both typenum
and const generics, providing the expressive bounds of typenum
, as well as its ability to specify an array size constant as an associated type, while also simultaneously enabling generic conversions to/from core arrays and selection of array sizes based on const generic parameters.
With these features combined, it should be possible to migrate code which currently uses generic-array
to use core arrays and const generics as the public-facing API, with typenum
used only to describe bounds and associated constants until such time as stable const generics are sufficiently expressive to natively implement those features.
The v0.2 release includes numerous improvements and new features based on our real world experiences from using it in the RustCrypto project. Our next set of breaking releases will migrate from generic-array
to hybrid-array
.
Enjoy!