Design document
novacrazy opened this issue · 2 comments
Recently on reddit I received a comment asking to describe the design of generic-array
, and after seeing some comments asking how it works/safety/performance and about my numeric-array
crate, I decided to give it a go.
If anyone wants to check it out, proofread it, point out things I got wrong, missed or should expand upon, etc. feel free.
It's not very formal, but I can make it more formal if deemed necessary.
@fizyk20 what do you think?
This reads really well. Also, this is kind of incredible:
ArrayLength's implementations use type-level recursion to peel away each least significant bit and form sort of an opaque binary tree of contigious data the correct physical size to store N elements of T. The tree, or block of data, is then stored inside of GenericArray to be reinterpreted as the array.
Looks great! It's a really nice description of the inner workings of the crate. Thanks for all the work you're putting into this!