-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement const generics #148
Conversation
ac89aac
to
68db238
Compare
Motivation for moving this forward now:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a BREAKING CHANGE
section to the commit message, explaining the UX changes (and other breaking changes in case there are any), so that people that upgrade know what to do (eventually I'd like to generate a changelog from the commit messages, but I never found the time to do that).
@koushiro You are the only Scale Codec user I know of. Would you mind having a look if things still work as expected. Would you be up for adding tests for the Scale Codec in a separate PR? I always fear we break that part accidentally. |
note for number 4, all the proposed ways of keeping the current API interface the same make use of storing the size in an associated constant which is NOT object safe. |
Rebased and squashed from #116. Closes #114. BREAKING CHANGE: This change replaces uses of typenum with const generics. Importantly, the MultihashDigest, Hasher, and StatefulHasher traits are now generic over the digest size due to compiler limitations. However, `Hasher` exposes this size as an associated const, so `MyHasherImpl::SIZE` can often be used to fill in the size parameter with some help from type inference. Additionally: - All usages of typenum must be replaced with usize constants. - The new MSRV is 1.51.0 due to const generics. - IdentityDigest is now a tuple struct of usize and the digest instead of u8 and a generic array.
f90c288
to
31ebd48
Compare
Multihashes/CIDs can be made object safe. But yeah, constructing a function that takes a |
Merging to a next branch so we can batch up a bunch of breaking changes without endangering master. |
Sorry for the late reply, the scale-codec part LGTM |
Rebased and squashed from #116.
Closes #114.