aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/pinentry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'nitrocli/src/pinentry.rs')
-rw-r--r--nitrocli/src/pinentry.rs23
1 files changed, 4 insertions, 19 deletions
diff --git a/nitrocli/src/pinentry.rs b/nitrocli/src/pinentry.rs
index 1eecdd0..d6f000c 100644
--- a/nitrocli/src/pinentry.rs
+++ b/nitrocli/src/pinentry.rs
@@ -26,25 +26,10 @@ use crate::error::Error;
///
/// The available PIN types correspond to the PIN types used by the Nitrokey devices: user and
/// admin.
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub enum PinType {
- /// The admin PIN.
- Admin,
- /// The user PIN.
- User,
-}
-
-impl str::FromStr for PinType {
- type Err = ();
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- match s {
- "admin" => Ok(PinType::Admin),
- "user" => Ok(PinType::User),
- _ => Err(()),
- }
- }
-}
+Enum! {PinType, [
+ Admin => "admin",
+ User => "user"
+]}
#[derive(Debug)]
pub struct PinEntry {