asn1_cereal/lib.rs
1//! # asn1-cereal
2//! A collection of encoders and decoders for BER, DER and ASN.1.
3//!
4//! The grains of this library are a collection of traits and macros, that
5//! allow serialization and deserialization of rust types to and from ASN.1.
6//!
7//! The `Asn1Info`, `BerSerialize` and `BerDeserialize` traits are what
8//! most users will want to use.
9//!
10//! # ASN.1 Elements
11//!
12//! These pages will provide more details on specific ASN.1 constructs.
13//!
14//! - SEQUENCE/SET [`ber::serial::seq`](ber/serial/seq/index.html)
15//! - SEQUENCE/SET OF [`ber::serial::seq_of`](ber/serial/seq_of/index.html)
16//! - CHOICE/ANY [`ber::serial::choice`](ber/serial/choice/index.html)
17//! - A ::= B [`ber::serial::alias`](ber/serial/alias/index.html)
18//! - OCTET STRING [`ber::serial::prim`](ber/serial/prim/index.html)
19//!
20//! # Example
21//!
22//! ```
23//! #[macro_use] extern crate asn1_cereal; fn main() {
24//! struct ShortSequence {
25//! z: u64,
26//! y: u32,
27//! }
28//!
29//! ber_sequence!(
30//! ShortSequence,
31//! "SHORT_SEQUENCE",
32//! z;
33//! y;
34//! );
35//!
36//! use asn1_cereal::BerSerialize;
37//!
38//! let data = ShortSequence{ z: 1, y: 2 };
39//! let mut bytes: Vec<u8> = Vec::new();
40//! BerSerialize::serialize(&data, &mut bytes).unwrap();
41//! }
42//! ```
43
44#![cfg_attr(feature="clippy", feature(plugin))]
45#![cfg_attr(feature="clippy", plugin(clippy))]
46
47#[macro_use]
48extern crate log;
49
50pub mod tag;
51pub mod err;
52pub mod byte;
53#[macro_use]
54pub mod info;
55pub mod ber;
56
57pub use info::Asn1Info;
58pub use ber::serial::traits::{BerSerialize, BerDeserialize};
59pub use ber::enc::{BER, DER, BERAlt, BerEncRules};
60pub use ber::serial::prim::OctetString;