diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-06 23:16:52 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-01-07 00:29:21 +0100 |
commit | 9015fcd2593467af128ca4114c3ff02952d1c93b (patch) | |
tree | 88b1f9ed4f0fcbbad0be3472c59e4a273ef9be62 /src | |
parent | 30264131262d9e926d3c14b0c92760fdc15ba5c8 (diff) | |
download | nitrokey-rs-9015fcd2593467af128ca4114c3ff02952d1c93b.tar.gz nitrokey-rs-9015fcd2593467af128ca4114c3ff02952d1c93b.tar.bz2 |
Document the Undefined error for the connect methods
Diffstat (limited to 'src')
-rw-r--r-- | src/device.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/device.rs b/src/device.rs index 31e14a9..dfc5de1 100644 --- a/src/device.rs +++ b/src/device.rs @@ -583,6 +583,10 @@ pub trait Device: Authenticate + GetPasswordSafe + GenerateOtp { /// Connects to a Nitrokey device. This method can be used to connect to any connected device, /// both a Nitrokey Pro and a Nitrokey Storage. /// +/// # Errors +/// +/// - [`Undefined`][] if no Nitrokey device is connected +/// /// # Example /// /// ``` @@ -595,6 +599,8 @@ pub trait Device: Authenticate + GetPasswordSafe + GenerateOtp { /// Err(err) => println!("Could not connect to a Nitrokey: {}", err), /// } /// ``` +/// +/// [`Undefined`]: enum.CommandError.html#variant.Undefined pub fn connect() -> Result<DeviceWrapper, CommandError> { unsafe { match nitrokey_sys::NK_login_auto() { @@ -675,6 +681,10 @@ impl Device for DeviceWrapper { impl Pro { /// Connects to a Nitrokey Pro. /// + /// # Errors + /// + /// - [`Undefined`][] if no Nitrokey device of the given model is connected + /// /// # Example /// /// ``` @@ -687,6 +697,8 @@ impl Pro { /// Err(err) => println!("Could not connect to the Nitrokey Pro: {}", err), /// } /// ``` + /// + /// [`Undefined`]: enum.CommandError.html#variant.Undefined pub fn connect() -> Result<Pro, CommandError> { // TODO: maybe Option instead of Result? match connect_model(Model::Pro) { @@ -715,6 +727,10 @@ impl GenerateOtp for Pro {} impl Storage { /// Connects to a Nitrokey Storage. /// + /// # Errors + /// + /// - [`Undefined`][] if no Nitrokey device of the given model is connected + /// /// # Example /// /// ``` @@ -727,6 +743,8 @@ impl Storage { /// Err(err) => println!("Could not connect to the Nitrokey Storage: {}", err), /// } /// ``` + /// + /// [`Undefined`]: enum.CommandError.html#variant.Undefined pub fn connect() -> Result<Storage, CommandError> { // TODO: maybe Option instead of Result? match connect_model(Model::Storage) { |