Skip to content

der: derive(Choice) needs constructed = "true" flag #1808

Open
@dishmaker

Description

@dishmaker

derive(Choice) needs constructed = "true" flag,
but derive(Sequence) does not.

#[derive(Choice)]
pub enum ImplicitChoice<'a> {
    // This works:
    #[asn1(context_specific = "3", tag_mode = "IMPLICIT", constructed = "true")]
    SequenceOfNulls(SequenceOf<Null, 1>),

    // This won't decode:
    #[asn1(context_specific = "3", tag_mode = "IMPLICIT")]
    SequenceOfNulls(SequenceOf<Null, 1>),
}

I mean, the Choice macro is clueless about the underlaying type.

Something like this is possible:

let tag: Tag = Tag::Utf8String;
match tag {
    String::TAG => {}
    Null::TAG => {}
    SequenceOf::<Null, 1>::TAG => {}
    // .. more choices
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions