diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/auth.rs | 18 | 
1 files changed, 15 insertions, 3 deletions
| diff --git a/src/auth.rs b/src/auth.rs index 8978f32..8cec49c 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1,7 +1,7 @@  // Copyright (C) 2018-2019 Robin Krahl <robin.krahl@ireas.org>  // SPDX-License-Identifier: MIT -use std::ops::Deref; +use std::ops;  use std::os::raw::c_char;  use std::os::raw::c_int; @@ -211,7 +211,7 @@ impl<T: Device> User<T> {      }  } -impl<T: Device> Deref for User<T> { +impl<T: Device> ops::Deref for User<T> {      type Target = T;      fn deref(&self) -> &Self::Target { @@ -219,6 +219,12 @@ impl<T: Device> Deref for User<T> {      }  } +impl<T: Device> ops::DerefMut for User<T> { +    fn deref_mut(&mut self) -> &mut T { +        &mut self.device +    } +} +  impl<T: Device> GenerateOtp for User<T> {      fn get_hotp_code(&self, slot: u8) -> Result<String, Error> {          result_from_string(unsafe { @@ -246,7 +252,7 @@ impl<T: Device> AuthenticatedDevice<T> for User<T> {      }  } -impl<T: Device> Deref for Admin<T> { +impl<T: Device> ops::Deref for Admin<T> {      type Target = T;      fn deref(&self) -> &Self::Target { @@ -254,6 +260,12 @@ impl<T: Device> Deref for Admin<T> {      }  } +impl<T: Device> ops::DerefMut for Admin<T> { +    fn deref_mut(&mut self) -> &mut T { +        &mut self.device +    } +} +  impl<T: Device> Admin<T> {      /// Forgets the user authentication and returns an unauthenticated device.  This method      /// consumes the authenticated device.  It does not perform any actual commands on the | 
