[−][src]Macro asn1_der::asn1_der_impl
This macro helps you to implement the DER-conversion-traits on your own structs
Usage: asn1_der_impl!(StructName{ field0_name, field1_name, ..., fieldN_name })
Example:
ⓘThis example is not tested
struct Address { street: String, house_number: u64, postal_code: u64, state: String, country: String } asn1_der_impl!(Address{ street, house_number, postal_code, state, country }); // Now our struct supports all DER-conversion-traits struct Customer { name: String, e_mail_address: String, postal_address: Address } asn1_der_impl!(Customer{ name, e_mail_address, postal_address }); // Now this struct supports all DER-conversion-traits too! It's only necessary that all fields implement the DER-conversion-traits // Serialization: let encoded = my_customer.clone().into_der_encoded(); // This returns a vector containing the DER-encoded representation of this customer (a sequence containing the struct's fields) // Parsing: let my_decoded_customer = Customer::from_der_encoded(encoded).unwrap(); // This returns our customer (if the data is valid)