Skip to main content

mcraw_tui/preview/
mod.rs

1pub mod encoders;
2pub mod pipeline;
3pub mod state;
4
5use std::time::Instant;
6
7#[derive(Debug)]
8pub enum PreviewState {
9    Empty,
10    Loading { started: Instant },
11    Ready {
12        sixel: Vec<u8>,
13        width: u32,
14        height: u32,
15    },
16    Error(String),
17}
18
19impl Default for PreviewState {
20    fn default() -> Self {
21        Self::Empty
22    }
23}
24
25impl PreviewState {
26    pub fn is_empty(&self) -> bool {
27        matches!(self, Self::Empty)
28    }
29
30    pub fn is_loading(&self) -> bool {
31        matches!(self, Self::Loading { .. })
32    }
33
34    pub fn is_ready(&self) -> bool {
35        matches!(self, Self::Ready { .. })
36    }
37}