Add associated Error type to Writable traits#597
Conversation
d032588 to
8d52b93
Compare
Add `type Error: From<WriteError>` to `Asn1Writable`, `SimpleAsn1Writable`, and `Asn1DefinedByWritable`. Update all implementations, the derive macros, writer infrastructure, and Choice macro accordingly. Derive bounds use loose `From`-based error conversion for regular fields and `Asn1Writable<Error = WriteError>` for tagged (implicit/explicit) fields to preserve perfect derive support. Includes a test demonstrating a custom error type. https://claude.ai/code/session_01BBujUNHUboN5Rv6MkVbbxU
8d52b93 to
3027716
Compare
|
@facutuesca I think this gets us started down the path we need. |
awesome! |
|
@alex how should we handle error types for |
|
Follow up PR to make SequenceWriter be generic over Error, I guess? |
I created a draft PR for that here: #599 I also created a branch in |
|
And that's sufficient?
…On Tue, Feb 24, 2026 at 2:00 PM Facundo Tuesca ***@***.***> wrote:
*facutuesca* left a comment (alex/rust-asn1#597)
<#597 (comment)>
Follow up PR to make SequenceWriter be generic over Error, I guess?
I created a draft PR for that here: #599
<#599>
I also created a branch in cryptography with the changes needed after
this PR and #599 <#599> are merged:
https://github.com/trail-of-forks/cryptography/tree/ft/asn1-custom-error
—
Reply to this email directly, view it on GitHub
<#597 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAGBCXWJEKEXWCIVI47BD4NSNUTAVCNFSM6AAAAACVKHNKQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSNJUGEYTENRTGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
I think so? All the tests pass. The only thing missing from that branch is actually bumping the |
|
Cool!
…On Tue, Feb 24, 2026 at 2:05 PM Facundo Tuesca ***@***.***> wrote:
facutuesca left a comment (alex/rust-asn1#597)
And that's sufficient?
I think so? All the tests pass. The only thing missing from that branch is actually bumping the rust-asn1 version in Cargo.toml once a new version is released.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
reaperhulk
left a comment
There was a problem hiding this comment.
to the extent that any macro is reviewable I have reviewed this 😛
Add
type Error: From<WriteError>toAsn1Writable,SimpleAsn1Writable, andAsn1DefinedByWritable. Update all implementations, the derive macros, writer infrastructure, and Choice macro accordingly.Derive bounds use loose
From-based error conversion for regular fields andAsn1Writable<Error = WriteError>for tagged (implicit/explicit) fields to preserve perfect derive support.Includes a test demonstrating a custom error type.
https://claude.ai/code/session_01BBujUNHUboN5Rv6MkVbbxU