-
Notifications
You must be signed in to change notification settings - Fork 136
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
der: Custom error types in derive macros. #1560
Conversation
`Sequence`, `Enumerated` and `Choice` macros now support `#[asn1(error = Ty)]` attribute that provides a custom error type for `Decode`/`DecodeValue` implementations. This addresses RustCrypto#1559.
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.
That looks good, the only thing that comes to mind would be to use a type to hold the attribute instead.
I've made a PR of what I had in mind in turbocool3r#1.
But it's mostly up to you.
Thanks, just merged, that's a nice way to reduce that code duplication. One last question is should the attribute be named something like |
It's already |
followup on #1
I can merge that later tonight and make an rc.1 release for it. |
der_derive: apply errortype to enumerated
Merged the second PR, also added docs. I think it's ready for merge. |
Add support for specifying a custom decode error type for
Sequence
,Enumerated
andChoice
derive macros using the#[asn1(error = Ty)]
attribute.This addresses #1559.