summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/device')
-rw-r--r--src/device/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/device/mod.rs b/src/device/mod.rs
index 83ab90d..067fdf6 100644
--- a/src/device/mod.rs
+++ b/src/device/mod.rs
@@ -18,7 +18,7 @@ use crate::error::{CommunicationError, Error, LibraryError};
use crate::otp::GenerateOtp;
use crate::pws::GetPasswordSafe;
use crate::util::{
- get_command_result, get_cstring, owned_str_from_ptr, result_from_string, result_or_error,
+ get_command_result, get_cstring, owned_str_from_ptr, result_or_error, run_with_string,
};
pub use pro::Pro;
@@ -375,8 +375,9 @@ pub trait Device<'a>: Authenticate<'a> + GetPasswordSafe<'a> + GenerateOtp + fmt
/// # }
/// ```
fn get_serial_number(&self) -> Result<SerialNumber, Error> {
- result_from_string(unsafe { nitrokey_sys::NK_device_serial_number() })
- .and_then(|s| s.parse())
+ run_with_string(unsafe { nitrokey_sys::NK_device_serial_number() }, |s| {
+ s.parse()
+ })
}
/// Returns the number of remaining authentication attempts for the user. The total number of