Skip to content
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

fix(rasn): correctly bind nested list item constraints #84

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

6d7a
Copy link
Member

@6d7a 6d7a commented Mar 3, 2025

No description provided.

@6d7a 6d7a merged commit 4654087 into main Mar 3, 2025
1 check passed
@6d7a 6d7a deleted the fix/414-inner-list-item branch March 3, 2025 20:40
@DavidLeeds
Copy link
Contributor

DavidLeeds commented Mar 4, 2025

@6d7a thank you for the bug fix! As a follow-up, would it be possible to eliminate the additional wrapper struct for anonymous SEQUENCE OF SEQUENCE? For example:

Go from:

        #[doc = " Anonymous SEQUENCE OF member "]
        #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
        #[rasn(delegate, value("1..=5"), identifier = "INTEGER")]
        pub struct AnonymousTicketAges(pub u8);
        #[doc = " Inner type "]
        #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
        #[rasn(delegate)]
        pub struct TicketAges(pub SequenceOf<AnonymousTicketAges>);
        #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
        #[rasn(automatic_tags)]
        pub struct Ticket {
            pub ages: TicketAges,
            pub passenger: Option<Passenger>,
        }

To:

        #[doc = "Ticket::ages SEQUENCE OF element"]
        #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
        #[rasn(delegate, value("1..=5"), identifier = "INTEGER")]
        pub struct TicketAgesElement(pub u8);
        #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
        #[rasn(automatic_tags)]
        pub struct Ticket {
            pub ages: SequenceOf<TicketAgesElement>,
            pub passenger: Option<Passenger>,
        }

This would reduce a significant amount of boilerplate code for complex ASN.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants