rasn_derive

Derive Macro AsnType

source
#[derive(AsnType)]
{
    // Attributes available to this derive:
    #[rasn]
}
Expand description

An automatic derive of the AsnType trait.

This macro will automatically generate an implementation of AsnType, and generate a compile-time check that all of your fields (if struct) or variants (if a choice style enum) have distinct tags.

§Shared Attributes

These attributes are available on containers, variants, and fields.

  • tag([class], number) — override the default tag with the one specified with this attribute. E.g. #[rasn(tag(context, 0))], you can also wrapp [class], number in explicit to mark it as a explicit tag (e.g. #[rasn(tag(explicit(0)))].)
§Container Attributes
  • crate_root The path to the rasn library to use in the macro.
  • enumerated/choice Use either #[rasn(choice)] or #[rasn(enumerated)]
  • delegate Only available for newtype wrappers (e.g. struct Delegate(T)); uses the inner T type for implementing the trait.