diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-18 11:55:49 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-18 11:57:49 +0100 |
commit | 194849f02675b1a3d957e3a5ce81668033a58ff4 (patch) | |
tree | 10cea086010240aa1e45ec4a304d6fcc1b6cd8f5 /openpgp | |
parent | 3dc2d24bc3920d0216ff7f19e01e4e073a292a24 (diff) |
openpgp: Add a conversion from KeyHandle to String.
- Add a function to convert a KeyHandle to a String like there are
functions to convert a Fingerprint and a KeyID to a String.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/keyhandle.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/openpgp/src/keyhandle.rs b/openpgp/src/keyhandle.rs index c5058b9d..e4fb3323 100644 --- a/openpgp/src/keyhandle.rs +++ b/openpgp/src/keyhandle.rs @@ -94,6 +94,15 @@ impl TryFrom<&KeyHandle> for Fingerprint { } } +impl From<KeyHandle> for String { + fn from(i: KeyHandle) -> Self { + match i { + KeyHandle::Fingerprint(i) => i.to_string(), + KeyHandle::KeyID(i) => i.to_string(), + } + } +} + impl PartialOrd for KeyHandle { fn partial_cmp(&self, other: &KeyHandle) -> Option<Ordering> { let a = self.as_slice(); |