aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-06-07 03:03:29 +0200
committerRobin Krahl <robin.krahl@ireas.org>2018-06-07 03:03:29 +0200
commitf035857d9a9dc14c85e6bdf22cbe72528235657d (patch)
treeb6ec10e06a025a8b226e882c4ee39cc802c67665 /src/lib.rs
parentbbe6740d0a0b3f4dd8c1593272a747cfbbb3006b (diff)
downloadnitrokey-rs-f035857d9a9dc14c85e6bdf22cbe72528235657d.tar.gz
nitrokey-rs-f035857d9a9dc14c85e6bdf22cbe72528235657d.tar.bz2
Use Result<(), CommandError> instead of CommandStatus
The Result enum is more idiomatic and easier to use than our custom CommandStatus enum with the same structure. This is especially true for the try operator ?.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 432ce4e..aa44706 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -37,7 +37,7 @@
//! Configure an HOTP slot:
//!
//! ```no_run
-//! use nitrokey::{Authenticate, CommandStatus, ConfigureOtp, OtpMode, OtpSlotData};
+//! use nitrokey::{Authenticate, ConfigureOtp, OtpMode, OtpSlotData};
//! # use nitrokey::CommandError;
//!
//! # fn try_main() -> Result<(), (CommandError)> {
@@ -46,8 +46,8 @@
//! match device.authenticate_admin("12345678") {
//! Ok(admin) => {
//! match admin.write_hotp_slot(slot_data, 0) {
-//! CommandStatus::Success => println!("Successfully wrote slot."),
-//! CommandStatus::Error(err) => println!("Could not write slot: {:?}", err),
+//! Ok(()) => println!("Successfully wrote slot."),
+//! Err(err) => println!("Could not write slot: {:?}", err),
//! }
//! },
//! Err((_, err)) => println!("Could not authenticate as admin: {:?}", err),
@@ -102,7 +102,7 @@ pub use config::Config;
pub use device::{connect, Device, DeviceWrapper, Pro, Storage};
pub use otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData};
pub use pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT};
-pub use util::{CommandError, CommandStatus, LogLevel};
+pub use util::{CommandError, LogLevel};
/// Enables or disables debug output. Calling this method with `true` is equivalent to setting the
/// log level to `Debug`; calling it with `false` is equivalent to the log level `Error` (see