macro_rules! asn1_choice {
(
choice $name:ident {
$( $variant:ident($combinator:expr): $combinator_type:ty ),+
$(,)?
}
) => { ... };
}
Expand description
Generate a combinator for an ASN.1 CHOICE
For example
ⓘ
asn1_choice! {
choice Test {
PrintableString(ASN1(PrintableString)): ASN1<PrintableString>,
UTF8String(ASN1(UTF8String)): ASN1<UTF8String>,
}
}
This essentially generates an OrdChoice
combinator over all the choices
NOTE: Since we can’t generate match branches in macros, there is a small
artifact in the definition of the result type: a last variant with name
Unreachable
, which should never be produced at runtime as the combinator
of Unreachable always fails