diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2023-03-08 01:05:34 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2023-03-13 15:24:20 +0100 |
commit | 62e52e7b1d88c98a5be051c407024e68ca506a90 (patch) | |
tree | 3b9052183a08b55d2fea3c6115d681c09c748cf7 | |
parent | bee82c2952512a5585e93f180180ca45468d4f2b (diff) |
openpgp: New constructor hex::Dumper::with_offset.
-rw-r--r-- | openpgp/NEWS | 1 | ||||
-rw-r--r-- | openpgp/src/fmt.rs | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/openpgp/NEWS b/openpgp/NEWS index cfabfe07..2bd12a72 100644 --- a/openpgp/NEWS +++ b/openpgp/NEWS @@ -10,6 +10,7 @@ - crypto::mem::Protected::new - crypto::mpi::SecretKeyMaterial::from_bytes - crypto::mpi::SecretKeyMaterial::from_bytes_with_checksum + - fmt::hex::Dumper::with_offset - policy::AsymmetricAlgorithm::BrainpoolP384 ** Deprecated functionality - crypto::mpi::SecretKeyMaterial::parse diff --git a/openpgp/src/fmt.rs b/openpgp/src/fmt.rs index 5f3cd206..65b1b79c 100644 --- a/openpgp/src/fmt.rs +++ b/openpgp/src/fmt.rs @@ -71,10 +71,21 @@ pub mod hex { /// The dump is written to `inner`. Every line is indented with /// `indent`. pub fn new<I: AsRef<str>>(inner: W, indent: I) -> Self { + Self::with_offset(inner, indent, 0) + } + + /// Creates a new dumper starting at the given offset. + /// + /// The dump is written to `inner`. Every line is indented with + /// `indent`. + pub fn with_offset<I>(inner: W, indent: I, offset: usize) -> Self + where + I: AsRef<str>, + { Dumper { inner, indent: indent.as_ref().into(), - offset: 0, + offset, } } |