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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#[derive(Clone, Copy)]
#[non_exhaustive]
pub struct Config {
pub(crate) rendering_mode: RenderingMode,
pub(crate) ctrl_c_quit: bool,
pub(crate) headless: bool,
}
impl Config {
pub fn new() -> Self {
Self::default()
}
pub fn with_rendering_mode(self, rendering_mode: RenderingMode) -> Self {
Self {
rendering_mode,
..self
}
}
pub fn without_ctrl_c_quit(self) -> Self {
Self {
ctrl_c_quit: false,
..self
}
}
pub fn with_headless(self) -> Self {
Self {
headless: true,
..self
}
}
}
impl Default for Config {
fn default() -> Self {
Self {
rendering_mode: Default::default(),
ctrl_c_quit: true,
headless: false,
}
}
}
#[derive(Clone, Copy)]
pub enum RenderingMode {
BaseColors,
Ansi,
Rgb,
}
impl Default for RenderingMode {
fn default() -> Self {
RenderingMode::Rgb
}
}