Skip to content

Commit c52e9c7

Browse files
robin-nitrokeynickray
authored andcommitted
Add default implementations for UserInterface methods
This patch adds dummy default implementations for all methods of the platform::UserInterface trait.
1 parent 7003414 commit c52e9c7

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/platform.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,36 @@ pub use crate::types::consent;
1616
pub trait UserInterface {
1717
/// Check if the user has indicated their presence so as to give
1818
/// consent to an action.
19-
fn check_user_presence(&mut self) -> consent::Level;
19+
fn check_user_presence(&mut self) -> consent::Level {
20+
consent::Level::None
21+
}
2022

2123
/// Set the state of Trussed to give potential feedback to the user.
22-
fn set_status(&mut self, status: ui::Status);
24+
fn set_status(&mut self, status: ui::Status) {
25+
let _ = status;
26+
}
2327

2428
/// May be called during idle periods to give the UI the opportunity to update.
25-
fn refresh(&mut self);
29+
fn refresh(&mut self) {}
2630

2731
/// Return the duration since startup.
28-
fn uptime(&mut self) -> core::time::Duration;
32+
fn uptime(&mut self) -> core::time::Duration {
33+
Default::default()
34+
}
2935

3036
/// Exit / reset the application
31-
fn reboot (&mut self, to: reboot::To) -> !;
37+
fn reboot (&mut self, to: reboot::To) -> ! {
38+
let _ = to;
39+
loop {
40+
continue
41+
}
42+
}
3243

3344
/// Trigger a visible or audible effect for the given duration that allows the user to identify
3445
/// the device.
35-
fn wink(&mut self, duration: core::time::Duration);
46+
fn wink(&mut self, duration: core::time::Duration) {
47+
let _ = duration;
48+
}
3649
}
3750

3851
// This is the same trick as in "store.rs",

0 commit comments

Comments
 (0)