1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! The `Screen` enum and its query methods.
/// The screen currently in the foreground.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Screen {
/// Startup splash while servers are discovered.
Splash,
/// A test is running.
Testing,
/// Final results of a completed test.
Results,
/// Keyboard shortcut reference.
Help,
/// Read-only view of the active configuration.
Settings,
/// Server selection list.
ServerSelect,
/// Theme selection list.
ThemeSelect,
/// Past results and trends.
Trends,
/// A fatal test error.
Error,
}
impl Screen {
/// Whether this screen is an overlay that returns to a parent screen.
#[must_use]
pub fn is_overlay(self) -> bool {
matches!(
self,
Self::Help | Self::Settings | Self::ServerSelect | Self::ThemeSelect | Self::Trends
)
}
/// Whether this screen animates continuously and needs steady redraws.
#[must_use]
pub fn is_animated(self) -> bool {
matches!(self, Self::Splash | Self::Testing)
}
}