Announcing hybrid-array
v0.1 - a generic array crate built on both const generics and typenum
:
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.
Finally, unlike generic-array
the implementation is 100% safe code!
Enjoy!