Skip to content

Add type aliases for OCSP and PKCS7 types#14528

Open
TaaviE wants to merge 1 commit intopyca:mainfrom
TaaviE:patch-alias
Open

Add type aliases for OCSP and PKCS7 types#14528
TaaviE wants to merge 1 commit intopyca:mainfrom
TaaviE:patch-alias

Conversation

@TaaviE
Copy link
Copy Markdown
Contributor

@TaaviE TaaviE commented Mar 23, 2026

No description provided.


#[allow(clippy::large_enum_variant)]
#[derive(asn1::Asn1Write, asn1::Asn1Read)]
pub enum CertificateChoices<'a> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not mean to suggest we should add these entire enums. My suggestion was to split out the type-alises you'd broken out of the existing code.

(Adding these entire untested enums is the opposite of my goal.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, CertificateSet contains CertificateChoices. RevocationInfoChoices contains RevocationInfoChoice. So on and so forth, I can't split out anything besides OCSPResponseStatus on its own.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can split out the type alias using the current tyeps, e.g.

pub type CertificateSet<'a> = common::Asn1ReadableOrWritable<
    asn1::SetOf<'a, certificate::Certificate<'a>>,
    asn1::SetOfWriter<'a,certificate::Certificate<'a>, Vec<certificate::Certificate<'a>>>,
>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes the substantiation of /Certificate/CertificateChoices/ a smaller diff.

It's not the biggest thing in the world, but if you want to make the diff easier to review, it does contribute.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't even become a noticeably smaller diff because second patch has to update these structures to use the new types? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants