From 2452d3e9e5c8570d1e04934a80e808ea4755ee36 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 16 Dec 2018 12:28:36 +0100 Subject: Add documentation for {Pro, Storage}::connect() --- src/device.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 { // 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 { // TODO: maybe Option instead of Result? match connect_model(Model::Storage) { -- cgit v1.2.3