summaryrefslogtreecommitdiffstats
path: root/src/openpgp
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2017-12-11 22:32:30 +0100
committerNeal H. Walfield <neal@pep.foundation>2017-12-11 22:32:30 +0100
commit9176ead2ca42a15598e4d5c0bc492205621aff54 (patch)
tree27a2900e471f44a798ba1945331925c06fdd2d88 /src/openpgp
parent97b11c2b633f67df659a7c2965dc2ac9535214a2 (diff)
Add a custom Debug implementation for PacketCommon.
- When a packet contained data, the output was much too verbose. Now, we only print whether there is data and the amount of data that we have.
Diffstat (limited to 'src/openpgp')
-rw-r--r--src/openpgp/openpgp.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/openpgp/openpgp.rs b/src/openpgp/openpgp.rs
index 9f8639f2..999dde4f 100644
--- a/src/openpgp/openpgp.rs
+++ b/src/openpgp/openpgp.rs
@@ -174,7 +174,6 @@ pub enum BodyLength {
Indeterminate,
}
-#[derive(Debug)]
#[derive(PartialEq)]
pub struct PacketCommon {
tag: Tag,
@@ -182,6 +181,17 @@ pub struct PacketCommon {
content: Option<Vec<u8>>,
}
+impl std::fmt::Debug for PacketCommon {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ f.debug_struct("Signature")
+ .field("tag", &self.tag)
+ .field("children", &self.children)
+ .field("content (bytes)",
+ &self.content.as_ref().map(|content| content.len()))
+ .finish()
+ }
+}
+
/// An OpenPGP packet's header.
#[derive(Debug)]
pub struct Header {