diff options
Diffstat (limited to 'src/device.rs')
-rw-r--r-- | src/device.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/device.rs b/src/device.rs index a74310a..fc07baf 100644 --- a/src/device.rs +++ b/src/device.rs @@ -565,6 +565,20 @@ impl GenerateOtp for DeviceWrapper { impl Device for DeviceWrapper {} impl Pro { + /// Connects to a Nitrokey Pro. + /// + /// # Example + /// + /// ``` + /// use nitrokey::DeviceWrapper; + /// + /// fn use_pro(device: Pro) {} + /// + /// match nitrokey::connect() { + /// Ok(device) => do_something(device), + /// Err(err) => println!("Could not connect to the Nitrokey Pro: {}", err), + /// } + /// ``` pub fn connect() -> Result<Pro, CommandError> { // TODO: maybe Option instead of Result? match connect_model(Model::Pro) { @@ -587,6 +601,20 @@ impl Device for Pro {} impl GenerateOtp for Pro {} impl Storage { + /// Connects to a Nitrokey Storage. + /// + /// # Example + /// + /// ``` + /// use nitrokey::DeviceWrapper; + /// + /// fn use_storage(device: Storage) {} + /// + /// match nitrokey::connect() { + /// Ok(device) => do_something(device), + /// Err(err) => println!("Could not connect to the Nitrokey Pro: {}", err), + /// } + /// ``` pub fn connect() -> Result<Storage, CommandError> { // TODO: maybe Option instead of Result? match connect_model(Model::Storage) { |