logo

Derive Macro der::Sequence

source · []
#[derive(Sequence)]
{
    // Attributes available to this derive:
    #[asn1]
}
This is supported on crate feature derive only.
Expand description

Derive the Sequence trait on a struct.

This custom derive macro can be used to automatically impl the Sequence trait for any struct which can be decoded/encoded as an ASN.1 SEQUENCE.

Usage

use der::{
    asn1::{Any, ObjectIdentifier},
    Sequence
};

/// X.509 `AlgorithmIdentifier`
#[derive(Sequence)]
pub struct AlgorithmIdentifier<'a> {
    /// This field contains an ASN.1 `OBJECT IDENTIFIER`, a.k.a. OID.
    pub algorithm: ObjectIdentifier,

    /// This field is `OPTIONAL` and contains the ASN.1 `ANY` type, which
    /// in this example allows arbitrary algorithm-defined parameters.
    pub parameters: Option<Any<'a>>
}

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

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