Skip to main content

mermaid_cli/tui/state/
status.rs

1/// Status state management
2///
3/// UI status messages and timing.
4
5use std::time::Instant;
6
7/// Status state - UI status messages and timing
8#[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    /// Set a status message
25    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    /// Clear the status message
31    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}