diff options
-rw-r--r-- | src/device.rs | 18 | ||||
-rw-r--r-- | src/lib.rs | 3 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/device.rs b/src/device.rs index e047975..792ac2f 100644 --- a/src/device.rs +++ b/src/device.rs @@ -33,6 +33,24 @@ impl fmt::Display for Model { } } +/// The access mode of a volume on the Nitrokey Storage. +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum VolumeMode { + /// A read-only volume. + ReadOnly, + /// A read-write volume. + ReadWrite, +} + +impl fmt::Display for VolumeMode { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self { + VolumeMode::ReadOnly => f.write_str("read-only"), + VolumeMode::ReadWrite => f.write_str("read-write"), + } + } +} + /// A wrapper for a Nitrokey device of unknown type. /// /// Use the function [`connect`][] to obtain a wrapped instance. The wrapper implements all traits @@ -98,7 +98,8 @@ use nitrokey_sys; pub use crate::auth::{Admin, Authenticate, User}; pub use crate::config::Config; pub use crate::device::{ - connect, connect_model, Device, DeviceWrapper, Model, Pro, Storage, StorageStatus, VolumeStatus, + connect, connect_model, Device, DeviceWrapper, Model, Pro, Storage, StorageStatus, VolumeMode, + VolumeStatus, }; pub use crate::otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData}; pub use crate::pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT}; |