summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-24 12:46:30 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-03-24 17:26:32 +0100
commit6a2a82648176e4b840bfed80e188c21b6bc63c4d (patch)
treec950bf066f36139a1ecb86e14bb03813ce3f808e
parent10b5ed603a298c43c80423d70bb6f61d2f3d3b68 (diff)
openpgp: Add convenience function hex::dump.
-rw-r--r--openpgp/src/fmt.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/openpgp/src/fmt.rs b/openpgp/src/fmt.rs
index 3b79ceba..afe98bb6 100644
--- a/openpgp/src/fmt.rs
+++ b/openpgp/src/fmt.rs
@@ -27,6 +27,12 @@ pub mod hex {
super::from_hex(hex.as_ref(), true)
}
+ /// Dumps binary data, like `hd(1)`.
+ pub fn dump<W: io::Write, B: AsRef<[u8]>>(sink: W, data: B)
+ -> io::Result<()> {
+ Dumper::new(sink, "").write_ascii(data)
+ }
+
/// Writes annotated hex dumps, like hd(1).
///
/// # Example
@@ -91,7 +97,7 @@ pub mod hex {
/// Writes a chunk of data with ASCII-representation.
///
- /// This produces output similar to `hexdump(1)`.
+ /// This produces output similar to `hd(1)`.
pub fn write_ascii<B>(&mut self, buf: B) -> io::Result<()>
where B: AsRef<[u8]>,
{