diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-13 17:37:30 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-13 17:37:30 +0100 |
commit | 18085745dc10fe347f17595d1f0442fd69ac86af (patch) | |
tree | 5acc8208c89044ff4b324b9722585cd3c394dc62 /openpgp/src/keyhandle.rs | |
parent | 3501cadbacd0c0482ad2c6a69868630aade586eb (diff) |
openpgp: Add conversions from &KeyID and &Fingerprint to KeyHandle
- Like we have functions to convert a slice of bytes to a KeyID or a
Fingerprint, and a &Fingerprint to a KeyID, add functions to
convert a &KeyID or a &Fingerprint to a KeyHandle.
Diffstat (limited to 'openpgp/src/keyhandle.rs')
-rw-r--r-- | openpgp/src/keyhandle.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/openpgp/src/keyhandle.rs b/openpgp/src/keyhandle.rs index fafbe36b..88a9acde 100644 --- a/openpgp/src/keyhandle.rs +++ b/openpgp/src/keyhandle.rs @@ -36,6 +36,12 @@ impl From<KeyID> for KeyHandle { } } +impl From<&KeyID> for KeyHandle { + fn from(i: &KeyID) -> Self { + KeyHandle::KeyID(i.clone()) + } +} + impl From<KeyHandle> for KeyID { fn from(i: KeyHandle) -> Self { match i { @@ -51,6 +57,12 @@ impl From<Fingerprint> for KeyHandle { } } +impl From<&Fingerprint> for KeyHandle { + fn from(i: &Fingerprint) -> Self { + KeyHandle::Fingerprint(i.clone()) + } +} + impl TryFrom<KeyHandle> for Fingerprint { type Error = failure::Error; fn try_from(i: KeyHandle) -> Result<Self> { |