summaryrefslogtreecommitdiffstats
path: root/src/app/status.rs
blob: de02584f089603e0a744b481e70b4030141de3e3 (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
/// 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,
        }
    }
}