summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-11-27 12:55:34 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-11-27 13:01:31 +0100
commitc64eb5733fa217f10e51f24dd1d6614703f0d828 (patch)
tree106a873a4e80161093cbd2f2a04aa25f9c4a6ddc /openpgp
parentf5f8a7b1b47d29c16083ba9d3dc5f88441376ea7 (diff)
openpgp: Rename ID to KeyHandle.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/id.rs60
-rw-r--r--openpgp/src/keyhandle.rs60
-rw-r--r--openpgp/src/lib.rs4
3 files changed, 62 insertions, 62 deletions
diff --git a/openpgp/src/id.rs b/openpgp/src/id.rs
deleted file mode 100644
index eafc3b20..00000000
--- a/openpgp/src/id.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-use std::convert::TryFrom;
-
-use crate::{
- Error,
- Fingerprint,
- KeyID,
- Result,
-};
-
-/// Identifies OpenPGP keys.
-///
-/// An `ID` is either a `Fingerprint` or a `KeyID`.
-#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
-pub enum ID {
- /// A Fingerprint.
- Fingerprint(Fingerprint),
- /// A KeyID.
- KeyID(KeyID),
-}
-
-impl std::fmt::Display for ID {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- match self {
- ID::Fingerprint(v) => v.fmt(f),
- ID::KeyID(v) => v.fmt(f),
- }
- }
-}
-
-impl From<KeyID> for ID {
- fn from(i: KeyID) -> Self {
- ID::KeyID(i)
- }
-}
-
-impl From<ID> for KeyID {
- fn from(i: ID) -> Self {
- match i {
- ID::Fingerprint(i) => i.into(),
- ID::KeyID(i) => i,
- }
- }
-}
-
-impl From<Fingerprint> for ID {
- fn from(i: Fingerprint) -> Self {
- ID::Fingerprint(i)
- }
-}
-
-impl TryFrom<ID> for Fingerprint {
- type Error = failure::Error;
- fn try_from(i: ID) -> Result<Self> {
- match i {
- ID::Fingerprint(i) => Ok(i),
- ID::KeyID(i) => Err(Error::InvalidOperation(
- format!("Cannot convert keyid {} to fingerprint", i)).into()),
- }
- }
-}
diff --git a/openpgp/src/keyhandle.rs b/openpgp/src/keyhandle.rs
new file mode 100644
index 00000000..a9433f84
--- /dev/null
+++ b/openpgp/src/keyhandle.rs
@@ -0,0 +1,60 @@
+use std::convert::TryFrom;
+
+use crate::{
+ Error,
+ Fingerprint,
+ KeyID,
+ Result,
+};
+
+/// Identifies OpenPGP keys.
+///
+/// An `KeyHandle` is either a `Fingerprint` or a `KeyID`.
+#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
+pub enum KeyHandle {
+ /// A Fingerprint.
+ Fingerprint(Fingerprint),
+ /// A KeyID.
+ KeyID(KeyID),
+}
+
+impl std::fmt::Display for KeyHandle {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ match self {
+ KeyHandle::Fingerprint(v) => v.fmt(f),
+ KeyHandle::KeyID(v) => v.fmt(f),
+ }
+ }
+}
+
+impl From<KeyID> for KeyHandle {
+ fn from(i: KeyID) -> Self {
+ KeyHandle::KeyID(i)
+ }
+}
+
+impl From<KeyHandle> for KeyID {
+ fn from(i: KeyHandle) -> Self {
+ match i {
+ KeyHandle::Fingerprint(i) => i.into(),
+ KeyHandle::KeyID(i) => i,
+ }
+ }
+}
+
+impl From<Fingerprint> for KeyHandle {
+ fn from(i: Fingerprint) -> Self {
+ KeyHandle::Fingerprint(i)
+ }
+}
+
+impl TryFrom<KeyHandle> for Fingerprint {
+ type Error = failure::Error;
+ fn try_from(i: KeyHandle) -> Result<Self> {
+ match i {
+ KeyHandle::Fingerprint(i) => Ok(i),
+ KeyHandle::KeyID(i) => Err(Error::InvalidOperation(
+ format!("Cannot convert keyid {} to fingerprint", i)).into()),
+ }
+ }
+}
diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs
index 058af071..dfc04ab2 100644
--- a/openpgp/src/lib.rs
+++ b/openpgp/src/lib.rs
@@ -145,8 +145,8 @@ use crate::types::{
mod fingerprint;
mod keyid;
-mod id;
-pub use id::ID;
+mod keyhandle;
+pub use keyhandle::KeyHandle;
#[cfg(test)]
mod tests;