summaryrefslogtreecommitdiffstats
path: root/openpgp/src/lib.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-27 13:59:06 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-03-27 14:08:22 +0100
commita3f64c655c9e212f79fbbb425fac58f1ee6ce5a9 (patch)
tree8d8e0d72390cd2beee010cb799e8297d246d85fb /openpgp/src/lib.rs
parent20a8c5a9b191112af4d9db974d51922c57217882 (diff)
openpgp: Define equality using the serialized OpenPGP form.
- All packets should be considered equal if the serialized OpenPGP form is equal, modulo framing (i.e. CTB type, packet length encoding, partial body chunking). - In cases this may lead to surprising outcomes, discuss this in the documentation, and provide additional equality predicates. - Fixes #92.
Diffstat (limited to 'openpgp/src/lib.rs')
-rw-r--r--openpgp/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs
index 5ac45b36..44480a45 100644
--- a/openpgp/src/lib.rs
+++ b/openpgp/src/lib.rs
@@ -332,6 +332,14 @@ pub enum Error {
///
/// 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 {