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}
13
14impl StatusState {
15    pub fn new() -> Self {
16        Self {
17            status_message: None,
18            status_timestamp: None,
19        }
20    }
21
22    /// Set a status message
23    pub fn set(&mut self, message: impl Into<String>) {
24        self.status_message = Some(message.into());
25        self.status_timestamp = Some(Instant::now());
26    }
27
28    /// Clear the status message
29    pub fn clear(&mut self) {
30        self.status_message = None;
31        self.status_timestamp = None;
32    }
33}
34
35impl Default for StatusState {
36    fn default() -> Self {
37        Self::new()
38    }
39}