diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2018-12-16 12:28:36 +0100 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2018-12-16 12:28:36 +0100 |
commit | 2452d3e9e5c8570d1e04934a80e808ea4755ee36 (patch) | |
tree | cbd07bd45508df05b47fa96fcf762eb9f6cafff1 | |
parent | cd3ffc6114661040e1989016588990ba8d662504 (diff) | |
download | nitrokey-rs-2452d3e9e5c8570d1e04934a80e808ea4755ee36.tar.gz nitrokey-rs-2452d3e9e5c8570d1e04934a80e808ea4755ee36.tar.bz2 |
Add documentation for {Pro, Storage}::connect()
-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) { |