Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Specific vs Generic ArraySize Implementations #80

jmwample started this conversation in Ideas
Discussion options

I may be missing something basic, but is there a reason that the implementations for the individual Arraysizes (i.e. U2, U3, ...) are all done manually? I understand that they are generated, but that is beside the point.

For the ArrayLength and Unsigned traits in generic_array and typenum respectively the implementations are done on UInt<T, B> and UTerm which allows any created value to automatically support the traits. In contrast hybrid_array::ArraySize only works for the explicitly handpicked values in sizes.rs.

If there is an obvious reason that this is impossible / overly complex for this crate I apologize, but if not, this would be useful to prevent future requests for the addition of custom ArraySizes.

You must be logged in to vote

Replies: 2 comments

Comment options

It's a consequence of Array being a wrapper around built-in arrays. Yes, because of that we lose flexibility of generic-array, but on the other hand we do not have complexity of its expanded code.

You must be logged in to vote
0 replies
Comment options

Yeah, like @newpavlov said each trait impl provides a specific concrete [T; N] array size, so it's the linkage between typenum sizes and core arrays, and what allows us to write most of the other trait impls using const generics.

Unfortunately this leads to one trait impl per size, which means the more sizes we add, the more it impacts compile times, which has been a frustrating tradeoff.

See also: #66

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /