aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auth.rs1
-rw-r--r--src/config.rs8
2 files changed, 7 insertions, 2 deletions
diff --git a/src/auth.rs b/src/auth.rs
index 0b000f7..cab1021 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -1,6 +1,7 @@
// Copyright (C) 2018-2019 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: MIT
+use std::convert::TryFrom as _;
use std::marker;
use std::ops;
use std::os::raw::c_char;
diff --git a/src/config.rs b/src/config.rs
index c273792..cb678d7 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,6 +1,8 @@
// Copyright (C) 2018-2019 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: MIT
+use std::convert;
+
use crate::error::{Error, LibraryError};
/// The configuration for a Nitrokey.
@@ -68,8 +70,10 @@ impl Config {
}
}
-impl RawConfig {
- pub fn try_from(config: Config) -> Result<RawConfig, Error> {
+impl convert::TryFrom<Config> for RawConfig {
+ type Error = Error;
+
+ fn try_from(config: Config) -> Result<RawConfig, Error> {
Ok(RawConfig {
numlock: option_to_config_otp_slot(config.numlock)?,
capslock: option_to_config_otp_slot(config.capslock)?,