Module asn1_cereal::ber::serial::seq [] [src]

Macros to generate the implementation of the serialization traits for Rust structs, as an ASN.1 SEQUENCE. You can technically use this for a SET, but it still assumes the elements are in order.

You can either use the shortcut ber_sequence! macro, or each of asn1_sequence_info!, ber_sequence_serialize! and ber_sequence_deserialize!.

#[macro_use] extern crate asn1_cereal; fn main() {
  struct ShortSequence {
    z: u64,
    y: u32,
  }

  ber_sequence!(
    ShortSequence,
    "SHORT_SEQUENCE",
    z;
    y;
  );

  // OR

  struct SomeSequence {
    a: u64,
    b: u32,
    c: String,
  }

  asn1_sequence_info!(SomeSequence, "SOME_SEQUENCE");
  ber_sequence_serialize!(SomeSequence, a; b; c;);
  ber_sequence_deserialize!(SomeSequence, a; b; c;);
}

Note that these macros won't handle SEQUENCE OF.