Derive Macro der::Choice[][src]

#[derive(Choice)]
{
    // Attributes available to this derive:
    #[asn1]
}
This is supported on crate feature derive only.

Derive the Choice trait on an enum.

This custom derive macro can be used to automatically impl the Decodable and Encodable traits along with the Choice supertrait for any enum representing an ASN.1 CHOICE.

Usage

// NOTE: requires the `derive` feature of `der`
use der::Choice;

/// `Time` as defined in RFC 5280
#[derive(Choice)]
pub enum Time {
    #[asn1(type = "UTCTime")]
    UtcTime(UtcTime),

    #[asn1(type = "GeneralizedTime")]
    GeneralTime(GeneralizedTime),
}

#[asn1(type = "...")] attribute

See toplevel documentation for the der_derive crate for more information about the #[asn1] attribute.