Skip to content

Enable typenum's const-generics feature#39

Merged
tarcieri merged 1 commit intomasterfrom
typenum/enable-const-generic-feature
Feb 5, 2024
Merged

Enable typenum's const-generics feature#39
tarcieri merged 1 commit intomasterfrom
typenum/enable-const-generic-feature

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Feb 5, 2024

Though this doesn't immediately leverage the feature, it could potentially be useful in implementing e.g. ArrayN or as a replacement for AssociatedArraySize.

Enabling the feature does make it accessible for downstream users as hybrid_array::typenum.

Though this doesn't immediately leverage the feature, it could
potentially be useful in implementing e.g. `ArrayN` or as a replacement
for `AssociatedArraySize`.

Enabling the feature does make it accessible for downstream users as
`hybrid_array::typenum`.
@tarcieri
Copy link
Member Author

tarcieri commented Feb 5, 2024

I tried using typenum::U<N> in various ways and all of them were somewhat unsatisfying.

The main problem is that it's built on ToUInt impls on Const<N>, so those need to be propagated in bounds.

AssociatedArraySize (despite the unwieldy name) makes for more convenient bounds, namely bounding on [T; N]: AssociatedArraySize + AsRef<Array<T, U>> versus:

where
    Const<N>: ToUInt,
    [T; N]: AsRef<Array<T, U>>

@tarcieri tarcieri merged commit 4263cc4 into master Feb 5, 2024
@tarcieri tarcieri deleted the typenum/enable-const-generic-feature branch February 5, 2024 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant