-
Notifications
You must be signed in to change notification settings - Fork 212
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
digest: add newtype!
macro
#1799
base: master
Are you sure you want to change the base?
Conversation
I'm a bit worried we have to list all the traits in the invocation of the macro and that consumers will drift inconsistent over time. We can't centrally add/implement a trait (like we could with the CoreWrapper or my set of macros (#1775)). |
What do you mean by "drift"? The list of traits should not change across semver-compatible releases of To make the list of traits less annoying, I plan to add several templates for the most common cases. In other words, instead of: newtype!(
/// SHA-256 hash
Sha256(..);
delegate:
Debug AlgorithmName
Clone Default Reset
BlockSizeUser OutputSizeUser HashMarker
Update FixedOutput FixedOutputReset
); We will write: newtype!(
/// SHA-256 hash
Sha256(..);
delegate_template: FixedOutputHash
); |
We've added traits in the previous cycle: #1098 (released in digest 0.10.4) We may continue to do so in the next one. Having to list the traits means we have to each consumers and bump the list everywhere and release them. |
Together with #1799 users would need to implement `AssociatedOid` manually for created newtypes. Also replaces `feature = "const-oid"` with `feature = "oid"`.
TODO: support generic parameters (e.g. output size) on generated newtype
Closes #1069