diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-30 16:02:49 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-02-02 10:21:25 +0000 |
commit | eef2118717878f3543248ebf2d099aebbedceacf (patch) | |
tree | fef3eadac198a21862c856e5aca106c7badc62d0 /src | |
parent | e97ccf213eec4e2d056c2f72079e4eeb7ac66f3f (diff) | |
download | nitrokey-rs-eef2118717878f3543248ebf2d099aebbedceacf.tar.gz nitrokey-rs-eef2118717878f3543248ebf2d099aebbedceacf.tar.bz2 |
Add device_mut method to DeviceWrapper
To prepare the mutability refactoring, we add a device_mut method to
DeviceWrapper that can be used to obtain a mutable reference to the
wrapped device.
Diffstat (limited to 'src')
-rw-r--r-- | src/device.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/device.rs b/src/device.rs index c985802..462e9dc 100644 --- a/src/device.rs +++ b/src/device.rs @@ -728,6 +728,13 @@ impl DeviceWrapper { DeviceWrapper::Pro(ref pro) => pro, } } + + fn device_mut(&mut self) -> &mut dyn Device { + match *self { + DeviceWrapper::Storage(ref mut storage) => storage, + DeviceWrapper::Pro(ref mut pro) => pro, + } + } } impl From<Pro> for DeviceWrapper { |