mermaid_cli/tui/state/
status.rs1use std::time::Instant;
6
7#[derive(Debug)]
9pub struct StatusState {
10 pub status_message: Option<String>,
11 pub status_timestamp: Option<Instant>,
12 pub custom_status: Option<String>,
13}
14
15impl StatusState {
16 pub fn new() -> Self {
17 Self {
18 status_message: None,
19 status_timestamp: None,
20 custom_status: None,
21 }
22 }
23
24 pub fn set(&mut self, message: impl Into<String>) {
26 self.status_message = Some(message.into());
27 self.status_timestamp = Some(Instant::now());
28 }
29
30 pub fn clear(&mut self) {
32 self.status_message = None;
33 self.status_timestamp = None;
34 }
35}
36
37impl Default for StatusState {
38 fn default() -> Self {
39 Self::new()
40 }
41}