//! Packet-related types.
//!
//! See [Section 4 of RFC 4880] for more details.
//!
//! [Section 4 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::slice;
use quickcheck::{Arbitrary, Gen};
use crate::Error;
use crate::Result;
#[macro_use]
mod container;
pub use container::Container;
pub use container::Body;
pub mod prelude;
use crate::crypto::KeyPair;
mod tag;
pub use self::tag::Tag;
pub mod header;
pub use self::header::Header;
mod unknown;
pub use self::unknown::Unknown;
pub mod signature;
pub mod one_pass_sig;
pub mod key;
mod marker;
pub use self::marker::Marker;
mod trust;
pub use self::trust::Trust;
mod userid;
pub use self::userid::UserID;
pub mod user_attribute;
pub use self::user_attribute::UserAttribute;
mod literal;
pub use self::literal::Literal;
mod compressed_data;
pub use self::compressed_data::CompressedData;
pub mod seip;
pub mod skesk;
pub mod pkesk;
mod mdc;
pub use self::mdc::MDC;
pub mod aed;
// DOC-HACK: To avoid having a top-level re-export of `Cert`, we move
// it in a submodule `def`.
pub use def::Packet;
mod def {
use super::*;
/// Enumeration of packet types.
///
/// The different OpenPGP packets are detailed in [Section 5 of RFC 4880].
///
/// The `Unknown` packet allows Sequoia to deal with packets that it
/// doesn't understand. The `Unknown` packet is basically a binary
/// blob that includes the packet's tag.
///
/// The unknown packet is also used for packets that are understood,
/// but use unsupported options. For instance, when the packet parser
/// encounters a compressed data packet with an unknown compression
/// algorithm, it returns the packet in an `Unknown` packet rather
/// than a `CompressedData` packet.
///
/// [Section 5 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5
///
/// Note: This enum cannot be exhaustively matched to allow future
/// extensions.
///
/// # A note on equality
///
/// We define equality on `Packet` like equality of the serialized
/// form of the packet bodies defined by RFC4880, i.e. two packets are
/// considered equal if and only if their serialized form is equal,
/// modulo the OpenPGP framing (`CTB` and length style, potential
/// partial body encoding).
#[derive(Debug)]
#[derive(PartialEq, Eq, Hash, Clone)]
pub enum Packet {
///