aboutsummaryrefslogtreecommitdiff
path: root/src/device.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/device.rs')
-rw-r--r--src/device.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/device.rs b/src/device.rs
index 287268b..2abf801 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -788,12 +788,16 @@ impl Pro {
pub fn connect() -> Result<Pro, Error> {
// TODO: maybe Option instead of Result?
match connect_enum(Model::Pro) {
- true => Ok(Pro {
- marker: marker::PhantomData,
- }),
+ true => Ok(Pro::new()),
false => Err(CommunicationError::NotConnected.into()),
}
}
+
+ fn new() -> Pro {
+ Pro {
+ marker: marker::PhantomData,
+ }
+ }
}
impl Drop for Pro {
@@ -836,13 +840,17 @@ impl Storage {
pub fn connect() -> Result<Storage, Error> {
// TODO: maybe Option instead of Result?
match connect_enum(Model::Storage) {
- true => Ok(Storage {
- marker: marker::PhantomData,
- }),
+ true => Ok(Storage::new()),
false => Err(CommunicationError::NotConnected.into()),
}
}
+ fn new() -> Storage {
+ Storage {
+ marker: marker::PhantomData,
+ }
+ }
+
/// Changes the update PIN.
///
/// The update PIN is used to enable firmware updates. Unlike the user and the admin PIN, the