summaryrefslogtreecommitdiffstats
path: root/src/app/status.rs
blob: e275f07b87bd85468c5ae1d54206038e9bbb7f1e (plain)
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
/// the status contains information written on the grey line
///  near the bottom of the screen
#[derive(Debug, Clone)]
pub struct Status {
    pub message: String, // markdown
    pub error: bool,     // is the current message an error?
}

impl Status {
    pub fn new<S: Into<String>>(message: S, error: bool) -> Status {
        Self {
            message: message.into(),
            error,
        }
    }

    pub fn from_message<S: Into<String>>(message: S) -> Status {
        Self {
            message: message.into(),
            error: false,
        }
    }

    pub fn from_error<S: Into<String>>(message: S) -> Status {
        Self {
            message: message.into(),
            error: true,
        }
    }
}