aboutsummaryrefslogtreecommitdiff
path: root/src/device.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/device.rs')
-rw-r--r--src/device.rs42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/device.rs b/src/device.rs
index a0df30e..f6492cd 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -71,10 +71,16 @@ impl fmt::Display for VolumeMode {
/// fn perform_other_task(device: &DeviceWrapper) {}
///
/// # fn try_main() -> Result<(), Error> {
-/// let mut device = nitrokey::connect()?;
-/// match device.authenticate_user("123456") {
-/// Ok(user) => perform_user_task(&user),
-/// Err(err) => eprintln!("Could not authenticate as user: {}", err),
+/// let device = nitrokey::connect()?;
+/// let device = match device.authenticate_user("123456") {
+/// Ok(user) => {
+/// perform_user_task(&user);
+/// user.device()
+/// },
+/// Err((device, err)) => {
+/// eprintln!("Could not authenticate as user: {}", err);
+/// device
+/// },
/// };
/// perform_other_task(&device);
/// # Ok(())
@@ -129,10 +135,16 @@ pub enum DeviceWrapper {
/// fn perform_other_task(device: &Pro) {}
///
/// # fn try_main() -> Result<(), Error> {
-/// let mut device = nitrokey::Pro::connect()?;
-/// match device.authenticate_user("123456") {
-/// Ok(user) => perform_user_task(&user),
-/// Err(err) => eprintln!("Could not authenticate as user: {}", err),
+/// let device = nitrokey::Pro::connect()?;
+/// let device = match device.authenticate_user("123456") {
+/// Ok(user) => {
+/// perform_user_task(&user);
+/// user.device()
+/// },
+/// Err((device, err)) => {
+/// eprintln!("Could not authenticate as user: {}", err);
+/// device
+/// },
/// };
/// perform_other_task(&device);
/// # Ok(())
@@ -169,10 +181,16 @@ pub struct Pro {
/// fn perform_other_task(device: &Storage) {}
///
/// # fn try_main() -> Result<(), Error> {
-/// let mut device = nitrokey::Storage::connect()?;
-/// match device.authenticate_user("123456") {
-/// Ok(user) => perform_user_task(&user),
-/// Err(err) => eprintln!("Could not authenticate as user: {}", err),
+/// let device = nitrokey::Storage::connect()?;
+/// let device = match device.authenticate_user("123456") {
+/// Ok(user) => {
+/// perform_user_task(&user);
+/// user.device()
+/// },
+/// Err((device, err)) => {
+/// eprintln!("Could not authenticate as user: {}", err);
+/// device
+/// },
/// };
/// perform_other_task(&device);
/// # Ok(())