summaryrefslogtreecommitdiffstats
path: root/openpgp/src/keyhandle.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-01-13 17:37:30 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-01-13 17:37:30 +0100
commit18085745dc10fe347f17595d1f0442fd69ac86af (patch)
tree5acc8208c89044ff4b324b9722585cd3c394dc62 /openpgp/src/keyhandle.rs
parent3501cadbacd0c0482ad2c6a69868630aade586eb (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.rs12
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> {