Macro asn1_cereal::asn1_info
[−]
[src]
macro_rules! asn1_info { ($rs_type:ty => $gen:ident, $($args:tt)*) => { ... }; (__impl [$($args:tt)*], $asn1_ty:expr) => { ... }; (__impl $class:expr, $tagnum:expr, $constructed:expr, $asn1_ty:expr) => { ... }; (__impl $asn1_ty:expr) => { ... }; (__type $asn1_ty:expr) => { ... }; ($rs_type:ty, $($args:tt)*) => { ... }; }
This macro defines the Asn1Info trait for a rust type.
This information is used to match tag information during deserialization, so it should match the expected values in the ASN.1 stream.
#[macro_use] extern crate asn1_cereal; fn main() { // For A ::= [APPLICATION 3] u64 struct A(u64); asn1_info!(A, [APPLICATION 3], "A"); // For B ::= [PRIVATE 3] u64 struct B(u64); asn1_info!(B, [PRIVATE 3], "B"); // For a primitive type, with application tag 3. struct C(u64); // (The false here sets the constructed flag). asn1_info!(C, asn1_cereal::tag::Class::Application, 3, false, "C"); } // For a type that won't have a tag. struct D(i32); asn1_info!(D, "D"); // For a type with a generic. struct E<T>(T); asn1_info!(E<T> => T, [PRIVATE 4], "E");